---
source_url: https://www.pubnub.com/docs/chat/unity-chat-sdk/learn/chat-entities/chat
title: Chat object
updated_at: 2026-04-01T12:14:29.000Z
---

# Chat object

## Documentation index

To discover more PubNub resources:

1. Fetch [PubNub's llms.txt](https://www.pubnub.com/llms-full.txt) for a list of available pages in Markdown format.
2. Identify relevant URLs from that index.
3. Fetch the target pages.

Do not assume a path exists, always check the index first.

The `Chat` object is your entry point to the Chat SDK after [initialization](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/configuration.md). Use the `Chat` object to create and manage channels, users, messages, memberships, and other entities.

Key capabilities:

* Create and delete channels and users
* Track user presence across channels
* Send custom events
* Access the underlying Unity SDK

## Properties

The `Chat` object has the following properties:

```csharp
// Unity-specific factory — lives on the UnityChat static class
public static async Task<ChatOperationResult<Chat>> UnityChat.CreateInstance(
    PubnubChatConfig chatConfig,
    PNConfiguration pubnubConfig,
    bool webGLBuildMode = false,
    bool unityLogging = false)

// Pass an existing Pubnub instance
public static async Task<ChatOperationResult<Chat>> UnityChat.CreateInstance(
    PubnubChatConfig chatConfig,
    Pubnub pubnub)

// Pass a PNConfigAsset Scriptable Object
public static async Task<ChatOperationResult<Chat>> UnityChat.CreateInstance(
    PubnubChatConfig chatConfig,
    PNConfigAsset configurationAsset,
    string userId)

public class PubnubChatConfig
{
    public int TypingTimeout { get; }
    public int TypingTimeoutDifference { get; }
    public bool StoreUserActivityTimestamp { get; }
    public int StoreUserActivityInterval { get; }
    public bool SyncMutedUsers { get; }
    public int RateLimitFactor { get; }
    public RateLimitPerChannel RateLimitsPerChannel { get; }
    public PushNotificationsConfig PushNotifications { get; }
    public Dictionary<string, bool> EmitReadReceiptEvents { get; }
}
```

To initialize the Chat SDK, you must provide a `PNConfiguration` object with `PublishKey`, `SubscribeKey`, and `UserId`. Read the [Configuration](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/configuration.md) page for all parameters and defaults.

### Events

The `Chat` object has the following events:

```csharp
// Base event that is generated each time any other event type is generated
public event Action<ChatEvent> OnAnyEvent; 
```

#### Example

Get an event that is triggered when any chat event occurs.

```csharp
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;
}
chat.OnAnyEvent += (chatEvent) =>
{
    Debug.Log($"New event of type {chatEvent.Type} received!");
};
```

## Methods

You can call the following methods on the `Chat` object.

Click on each method for more details.

### Standard methods

* [CreateDirectConversation()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/create.md#create-direct-channel)
* [CreateGroupConversation()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/create.md#create-group-channel)
* [CreatePublicConversation()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/create.md#create-public-channel)
* [CreateUser()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/users/create.md)
* [DeleteChannel()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/delete.md)
* [DeleteUser()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/users/delete.md)
* [DisconnectSubscriptions()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/watch.md#disconnect-all-subscriptions)
* [GetChannel()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/details.md)
* [GetChannelMemberships()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/membership.md#get-membership)
* [GetChannels()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/list.md)
* [GetCurrentUser()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/users/details.md#get-current-user)
* [GetCurrentUserMentions()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/users/mentions.md#collect-all-user-related-mentions)
* [GetEventsHistory()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/custom-events.md#get-historical-events)
* [GetPushChannels()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/push-notifications.md#list-all-push-channels)
* [GetThreadChannel()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/threads.md#get-thread)
* [GetUnreadMessagesCounts()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/unread.md#get-unread-messages-count-all-channels)
* [GetUser()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/users/details.md#get-user-details)
* [GetUserMemberships()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/membership.md#get-membership)
* [GetUsers()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/users/list.md)
* [InviteToChannel()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/invite.md#invite-one-user)
* [InviteMultipleToChannel()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/invite.md#invite-multiple-users)
* [IsPresent()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/users/presence.md#check-users-channel-presence)
* [MarkAllMessagesAsRead()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/unread.md#mark-messages-as-read-all-channels)
* [ReconnectSubscriptions()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/watch.md#reconnect-all-subscriptions)
* [RegisterPushChannels()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/push-notifications.md#register-selected-push-channels)
* [SetRestriction()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/users/moderation.md#mute-or-ban-users)
* [UnRegisterAllPushChannels()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/push-notifications.md#unregister-all-push-channels)
* [UnRegisterPushChannels()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/push-notifications.md#unregister-selected-push-channels)
* [UpdateChannel()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/updates.md#update-channel-details)
* [UpdateUser()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/users/updates.md#update-user-details)
* [WherePresent()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/users/presence.md#return-channels-where-user-is-present)
* [WhoIsPresent()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/users/presence.md#return-all-users-present-on-channel)

### Streaming methods

These methods register or unregister real-time event subscriptions. Each streaming method activates one or more of the events listed in the [Events](#events) section above.

* [StreamSubscriptionStatus()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/watch.md#stream-subscription-status)

## Use case

For example, you can use the `Chat` object methods to:

* Create a [channel](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/create.md) or [user](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/users/create.md).
* Get [channel](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/channels/details.md) or [user](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/users/details.md#get-user-details) data.

Last updated at: 2026-04-01T12:14:29.000Z
