# Chat Stream

{% hint style="success" %}

#### Like what your seeing?

Support us as a [GitHub Sponsor](/old-kb/where-to-buy/become-a-sponsor.md) and get instant access to all our assets, exclusive tools and assets, escalated support and issue tracking and our gratitude.\
\
These articles are made possible by our [GitHub Sponsors](/old-kb/where-to-buy/become-a-sponsor.md) ... become a sponsor today!
{% endhint %}

## Introduction

Displays a flow of chat messages such as those received from the [Clan Chat Director](/old-kb/old-toolkit-for-steamworks/unity/objects/ui-components/clan-chat-director.md) or [Lobby Chat Director](/old-kb/old-toolkit-for-steamworks/unity/objects/ui-components/lobby-chat-director.md).

```csharp
namespace HeathenEngineering.SteamworksIntegration.UI
```

```csharp
public class ChatStream : MonoBehaviour
```

## Fields and Attributes

### History Length

{% code fullWidth="false" %}

```csharp
[SerializeField]
private uint historyLength = 200;
```

{% endcode %}

How many chat entries should the tool maintain. When the count exceeds this number the oldest message will be destroyed. This is important for managing total memory use and keeping Unity UI from getting out of hand with long or fast running chats.

### Content

```csharp
[SerializeField]
private Transform content;
```

The root where chat messages will be spawned as they come in

### Message Template

```csharp
[SerializeField]
private GameObject messageTemplate;
```

The object that will be cloned / instantiated for each received message. This should contain a component in the root of the template that implements the [IChatMessage](/old-kb/old-toolkit-for-steamworks/unity/objects/programming-tools/ichatmessage.md) interface.

## Methods

### Handle Clan Message

```csharp
public void HandleClanMessage(ClanChatMsg message)
```

Used by the [Clan Chat Director](/old-kb/old-toolkit-for-steamworks/unity/objects/ui-components/clan-chat-director.md) to apply a clan chat message

### Handle Lobby Message

```csharp
public void HandleLobbyMessage(LobbyChatMsg message)
```

Used by the [Lobby Chat Director](/old-kb/old-toolkit-for-steamworks/unity/objects/ui-components/lobby-chat-director.md) to apply a lobby chat message

### Handle Message

```csharp
public void HandleMessage(UserData sender, string message, EChatEntryType type)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kb.heathen.group/old-kb/old-toolkit-for-steamworks/unity/objects/ui-components/chat-stream.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
