For AI agents: this page in Markdown: https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/users/delete.md. Documentation index: https://www.pubnub.com/llms-full.txt.
Delete users
Permanently remove a user from App Context storage with Delete() or DeleteUser().
Both methods produce the same result. Call Delete() on a User object or DeleteUser() on the Chat object with the user ID.
Soft delete deprecated
Soft deletion for users has been deprecated. Delete() now always performs a hard delete. Use Delete() without any parameters to permanently remove a user. The soft parameter and Restore() method are no longer available for users.
Requires App Context
Enable App Context in the Admin Portal to store user data.
Method signature
These methods take the following parameters:
-
Delete()(on theUserobject)1user.Delete() -
DeleteUser()(on theChatobject)1chat.DeleteUser(string userId)
Input
userId#- Unique user identifier (up to 92 UTF-8 characters).
- Required in Delete()
- No
- Required in DeleteUser()
- Yes
Output
| Type | Description |
|---|---|
Task<ChatOperationResult> | Returned Task that you can await to get the result of the delete operation. |
Sample code
Permanently delete user support_agent_15.
-
Delete()(on theUserobject)
show all 29 lines1using System.Threading.Tasks;
2using PubnubApi;
3using PubnubChatApi;
4using UnityEngine;
5
6// Configuration
7PubnubChatConfig chatConfig = new PubnubChatConfig();
8
9PNConfiguration pnConfiguration = new PNConfiguration(new UserId("myUniqueUserId"))
10{
11 SubscribeKey = "demo",
12 PublishKey = "demo",
13 Secure = true
14};
15 -
DeleteUser()(on theChatobject)
show all 22 lines1using System.Threading.Tasks;
2using PubnubApi;
3using PubnubChatApi;
4using UnityEngine;
5
6// Configuration
7PubnubChatConfig chatConfig = new PubnubChatConfig();
8
9PNConfiguration pnConfiguration = new PNConfiguration(new UserId("myUniqueUserId"))
10{
11 SubscribeKey = "demo",
12 PublishKey = "demo",
13 Secure = true
14};
15