Class ChatStreamingIndicator
The "the agent is working" line shown above a streaming answer.
Inheritance
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
[UxmlElement]
public class ChatStreamingIndicator : BaseVisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder
Remarks
While streaming, the indicator shows the Unity mark filling itself in next to a present-tense verb, for instance "Thinking". Once completed is set it settles into the solid mark and the past tense with the duration, for instance "Thought for 6s".
The animation is not this component's: it is the Animated variant of UnityLogo, which already owns a scheduled fill driver that starts on attach and stops on detach. This element only swaps the variant, so there is exactly one animation driver in the package rather than two.
The verb pair is picked at random when the indicator is constructed, the same way the web implementation picks one per message, so a long conversation does not read as a stuck loop. verbIndex pins it when you need a deterministic rendering.
durationMs is optional. Left at unknownDuration, the completed line reports how long the indicator itself was on screen; set it when the caller already knows the real duration of the turn.
Examples
A live indicator, with optional stats in parentheses.
var indicator = new ChatStreamingIndicator { stats = "2 tools • 1.2k tokens" };
parentElement.Add(indicator);
Settling it when the turn is over.
indicator.durationMs = 6400;
indicator.completed = true;
In UXML.
<appui:ChatStreamingIndicator />
<appui:ChatStreamingIndicator completed="true" duration-ms="90000" />
Constructors
ChatStreamingIndicator()
Default constructor.
Declaration
public ChatStreamingIndicator()
Fields
completedUssClassName
The styling class applied once the turn is over.
Declaration
public const string completedUssClassName = "appui-chat-streaming-indicator--completed"
Field Value
| Type | Description |
|---|---|
| string |
iconUssClassName
The styling class applied to a custom icon.
Declaration
public const string iconUssClassName = "appui-chat-streaming-indicator__icon"
Field Value
| Type | Description |
|---|---|
| string |
labelUssClassName
The styling class of the verb label.
Declaration
public const string labelUssClassName = "appui-chat-streaming-indicator__label"
Field Value
| Type | Description |
|---|---|
| string |
logoUssClassName
The styling class of the Unity mark.
Declaration
public const string logoUssClassName = "appui-chat-streaming-indicator__logo"
Field Value
| Type | Description |
|---|---|
| string |
statsUssClassName
The styling class of the trailing stats.
Declaration
public const string statsUssClassName = "appui-chat-streaming-indicator__stats"
Field Value
| Type | Description |
|---|---|
| string |
unknownDuration
The value of durationMs that means "nobody told me, measure it yourself".
Declaration
public const int unknownDuration = -1
Field Value
| Type | Description |
|---|---|
| int |
ussClassName
The ChatStreamingIndicator main styling class.
Declaration
public const string ussClassName = "appui-chat-streaming-indicator"
Field Value
| Type | Description |
|---|---|
| string |
verbUssClassName
The styling class applied to the element renderVerb returns.
Declaration
public const string verbUssClassName = "appui-chat-streaming-indicator__verb"
Field Value
| Type | Description |
|---|---|
| string |
Properties
completed
Whether the turn is over. False by default.
Declaration
[CreateProperty]
[UxmlAttribute]
public bool completed { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
Flipping this to true freezes the measured elapsed time, so a completed indicator does not keep counting up while it stays on screen.
durationMs
How long the turn took, in milliseconds. unknownDuration by default, which makes the indicator report its own on-screen time instead.
Declaration
[CreateProperty]
[UxmlAttribute]
public int durationMs { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
icon
A mark shown before the verb in place of the Unity logo, in both states. Null, the default, keeps the logo.
Declaration
[CreateProperty]
public VisualElement icon { get; set; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
Remarks
The registry's icon. While a custom mark is set the logo is hidden and held on its
filled variant, so its animation driver does not run behind it.
label
The line the indicator currently reads.
Declaration
public string label { get; }
Property Value
| Type | Description |
|---|---|
| string |
logo
The Unity mark the indicator animates.
Declaration
public UnityLogo logo { get; }
Property Value
| Type | Description |
|---|---|
| UnityLogo |
renderVerb
Renders the live verb ("Considering") as an element of the host's own, so it can give the verb a treatment of its own. Null, the default, keeps the verb under the sweep.
Declaration
[CreateProperty]
public Func<string, VisualElement> renderVerb { get; set; }
Property Value
| Type | Description |
|---|---|
| Func<string, VisualElement> |
Remarks
The registry's renderVerb. The rendered element replaces the sweep rather than
wrapping it: both paint the text, and two would fight. It is used only while the turn runs;
the completed line ("Considered for 6s") stays plain. A function that returns null renders
no verb at all, rather than bringing the sweep back.
The function builds an element, so it runs when the verb changes or the function is replaced, not on every refresh: a stats update does not rebuild the verb.
startTime
When the turn started, so the elapsed time survives the element being rebuilt.
Declaration
[CreateProperty]
public DateTime? startTime { get; set; }
Property Value
| Type | Description |
|---|---|
| DateTime? |
Remarks
Unset, the indicator measures from its own construction, which is right for an element
that lives as long as the turn. A host that rebuilds its message list mid-turn destroys
and recreates this element, and a construction-time origin would restart the count from
zero every time; handing the message's own createdAt in keeps
it honest. This is the registry's startTimeMs, in the wall-clock currency the
rest of the chat suite already speaks.
It is deliberately a wall clock rather than the frame clock the fallback uses. A frame clock has no meaning across the rebuild this property exists to survive.
stats
Extra detail shown in parentheses while streaming, for instance "2 tools • 1.2k tokens". Null or empty hides the trailing element entirely.
Declaration
[CreateProperty]
[UxmlAttribute]
public string stats { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
verbIndex
Which verb pair the indicator uses, as an index into verbs. Randomized at construction; set it to pin the wording.
Declaration
[CreateProperty]
[UxmlAttribute]
public int verbIndex { get; set; }
Property Value
| Type | Description |
|---|---|
| int |