---
source_url: https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/users/updates
title: Manage user updates
updated_at: 2026-05-25T11:25:53.473Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Manage user updates

Update user details and receive events whenever someone updates them.

:::note Requires App Context
Enable [App Context](https://youtu.be/9UEoSlngpYI) in the [Admin Portal](https://admin.pubnub.com/) to store user data.
:::

## Update user details

Edit user metadata with `Update()` or `UpdateUser()`.

* `Update()` - call on a `User` object (no ID needed)
* `UpdateUser()` - call on a `Chat` object (requires user ID)

### Method signature

These methods take the following parameters:

* Update() 1user.Update(ChatUserData updatedData);2 3public class ChatUserData4{5 public string Username { get; set; } = string.Empty;6 public string ExternalId { get; set; } = string.Empty;7 public string ProfileUrl { get; set; } = string.Empty;8 public string Email { get; set; } = string.Empty;9 public string CustomDataJson { get; set; } = string.Empty;10 public string Status { get; set; } = string.Empty;11 public string Type { get; set; } = string.Empty;12}
* UpdateUser() 1chat.UpdateUser(2 string Id, 3 ChatUserData updatedData4)5 6public class ChatUserData7{8 public string Username { get; set; } = string.Empty;9 public string ExternalId { get; set; } = string.Empty;10 public string ProfileUrl { get; set; } = string.Empty;11 public string Email { get; set; } = string.Empty;12 public string CustomDataJson { get; set; } = string.Empty;13 public string Status { get; set; } = string.Empty;14 public string Type { get; set; } = string.Empty;15}

#### Input

| Parameter | Required in Update() | Required in UpdateUser() | Description |
| --- | --- | --- | --- |
| Id | string | Optional |  | No | Yes | [Unique user identifier](https://www.pubnub.com/docs/general/setup/users-and-devices#user-id-usage). |
| > Username | string | Optional |  | No | No | Display name for the user (must not be empty or consist only of whitespace characters). |
| > ExternalId | string | Optional |  | No | No | User's identifier in an external system. You can use it to match `Id` with a similar identifier from an external database. |
| > ProfileUrl | string | Optional |  | No | No | URL of the user's profile picture. |
| > Email | string | Optional |  | No | No | User's email address. |
| > CustomDataJson | ObjectCustom | Optional |  | No | No | JSON providing custom data about the user. Values must be scalar only; arrays or objects are not supported. [Filtering App Context data](https://www.pubnub.com/docs/general/metadata/filtering) through the custom property is not recommended in SDKs. |
| > Status | string | Optional |  | No | No | Tag that lets you categorize your app users by their current state. The tag choice is entirely up to you and depends on your use case. For example, you can use `status` to mark users in your chat app as `Invited`, `Active`, or `Archived`. |
| > Type | string | Optional |  | No | No | Tag that lets you categorize your app users by their functional roles. The tag choice is entirely up to you and depends on your use case. For example, you can use `type` to group users by their roles in your app, such as `Moderator`, `Player`, or `Support-Agent`. |

:::tip API limits
To learn about the maximum length of parameters used to set user metadata, refer to [REST API docs](https://www.pubnub.com/docs/sdks/rest-api/set-user-metadata).
:::

#### Output

Both methods return an awaitable `Task`.

### Sample code

Change the link to the user's `support_agent_15` LinkedIn profile to `https://www.linkedin.com/mkelly_vp2`.

* Update() using System; using System.Collections.Generic; using System.Threading.Tasks; using PubnubApi; using PubnubChatApi; using UnityEngine; // Configuration PubnubChatConfig chatConfig = new PubnubChatConfig(); PNConfiguration pnConfiguration = new PNConfiguration(new UserId("myUniqueUserId")) { SubscribeKey = "demo", PublishKey = "demo", Secure = true }; // Initialize Unity Chat var chatResult = await UnityChat.CreateInstance(chatConfig, pnConfiguration); if (!chatResult.Error) { chat = chatResult.Result; } var userResult = await chat.GetUser("user_id"); if (userResult.Error) { Debug.Log("Couldn't find user!"); return; } var user = userResult.Result; var updatedUserData = new ChatUserData { ProfileUrl = "https://www.linkedin.com/mkelly_vp2" }; await user.Update(updatedUserData);
* UpdateUser() using System; using System.Collections.Generic; using System.Threading.Tasks; using PubnubApi; using PubnubChatApi; using UnityEngine; // Configuration PubnubChatConfig chatConfig = new PubnubChatConfig(); PNConfiguration pnConfiguration = new PNConfiguration(new UserId("myUniqueUserId")) { SubscribeKey = "demo", PublishKey = "demo", Secure = true }; // Initialize Unity Chat var chatResult = await UnityChat.CreateInstance(chatConfig, pnConfiguration); if (!chatResult.Error) { chat = chatResult.Result; } var updatedUserData = new ChatUserData { ProfileUrl = "https://www.linkedin.com/mkelly_vp2" }; await chat.UpdateUser("support_agent_15", updatedUserData);

## Get user updates

Receive updates when [User objects](https://www.pubnub.com/docs/chat/unity-chat-sdk/learn/chat-entities/user) are edited or deleted:

* `StreamUpdates()` - monitors a single user
* `StreamUpdatesOn()` - monitors multiple users

Both methods accept a callback invoked when user metadata changes. They subscribe to a channel and add an [objects event listener](https://www.pubnub.com/docs/sdks/unity/api-reference/configuration#event-listeners) for `uuid` events.

Call `StreamUpdates(true)` to enable the `OnUpdated` and `OnDeleted` events on the user entity. `OnUpdated` fires when user metadata changes. `OnDeleted` fires when the user is hard-deleted from App Context.

:::tip Method naming
Earlier versions used `SetListeningForUpdates()` to enable streaming. This method has been superseded by `StreamUpdates()`, though it remains available for backward compatibility.
:::

### Method signature

These methods take the following parameters:

* StreamUpdates() 1user.StreamUpdates(bool stream)
* OnUpdated 1// event on the User entity2public event Action<User> OnUpdated;3// needs a corresponding event handler4void EventHandler(User user)
* OnDeleted 1// event on the User entity2public event Action OnDeleted;3// needs a corresponding event handler4void EventHandler()
* StreamUpdatesOn() (static) 1User.StreamUpdatesOn(2 List<User> users,3 Action<User> listener4)

#### Input

| Parameter | Required in `StreamUpdates()` | Required in `OnUpdated` / `OnDeleted` | Required in `StreamUpdatesOn()` | Description |
| --- | --- | --- | --- | --- |
| `stream`Type: `bool`Default: n/a | Yes | n/a | n/a | Whether to start (`true`) or stop (`false`) listening to `User` object updates. |
| `users`Type: `List<User>`Default: n/a | No | No | Yes | List of [User objects](https://www.pubnub.com/docs/chat/unity-chat-sdk/learn/chat-entities/user) for which you want to get updates. |
| `listener`Type: `Action<User>`Default: n/a | No | No | Yes | Callback that receives the specific user that was updated. |

#### Output

These methods don't return a value. Updates are delivered through event handlers or callback functions.

### Sample code

* StreamUpdates() and OnUpdated Get updates on support_agent_15. using System; using System.Collections.Generic; using System.Threading.Tasks; using PubnubApi; using PubnubChatApi; using UnityEngine; // Configuration PubnubChatConfig chatConfig = new PubnubChatConfig(); PNConfiguration pnConfiguration = new PNConfiguration(new UserId("myUniqueUserId")) { SubscribeKey = "demo", PublishKey = "demo", Secure = true }; // Initialize Unity Chat var chatResult = await UnityChat.CreateInstance(chatConfig, pnConfiguration); if (!chatResult.Error) { chat = chatResult.Result; } var userResult = await chat.GetUser("support_agent_15"); if (userResult.Error) { Debug.Log("Couldn't find user!"); return; } var user = userResult.Result; user.StreamUpdates(true); user.OnUpdated += OnUserUpdatedHandler; // or use lambda void OnUserUpdatedHandler(User user) { Debug.Log($"User updated: {user.Id}"); }
* StreamUpdatesOn() Get updates on support-agent-1 and support-agent-2. using System; using System.Collections.Generic; using System.Threading.Tasks; using PubnubApi; using PubnubChatApi; using UnityEngine; // Configuration PubnubChatConfig chatConfig = new PubnubChatConfig(); PNConfiguration pnConfiguration = new PNConfiguration(new UserId("myUniqueUserId")) { SubscribeKey = "demo", PublishKey = "demo", Secure = true }; // Initialize Unity Chat var chatResult = await UnityChat.CreateInstance(chatConfig, pnConfiguration); if (!chatResult.Error) { chat = chatResult.Result; } var users = new List<User>(); var getFirstUser = await chat.GetUser("support-agent-1"); var getSecondUser = await chat.GetUser("support-agent-2"); if (!getFirstUser.Error && !getSecondUser.Error) { users.Add(getFirstUser.Result); users.Add(getSecondUser.Result); } Action<User> listener = (user) => { // Print the updated user name and the type of update Debug.Log("Updated user Name: " + user.UserName); }; User.StreamUpdatesOn(users, listener);