docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ChatMessage

    One message in a conversation, as data. Not a VisualElement — hand a sequence of these to messages and it builds the tree.

    Inheritance
    object
    ChatMessage
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.AppUI.UI
    Assembly: Unity.AppUI.dll
    Syntax
    public class ChatMessage
    Remarks

    A message carries either plain content or a list of parts. When parts is set it wins, and content is ignored.

    Fields

    attachments

    Labels of the files the message was sent with. Shown as chips inside a user bubble.

    Declaration
    public IEnumerable<string> attachments
    Field Value
    Type Description
    IEnumerable<string>

    content

    The message's plain text, used when parts is null.

    Declaration
    public string content
    Field Value
    Type Description
    string

    contextItems

    Labels of the context entries the message was sent with. Shown as chips inside a user bubble.

    Declaration
    public IEnumerable<string> contextItems
    Field Value
    Type Description
    IEnumerable<string>

    createdAt

    When the backend recorded the message. Two of these bracket a turn, which is where the elapsed-to-answer figure comes from when durationMs is absent.

    Declaration
    public DateTime? createdAt
    Field Value
    Type Description
    DateTime?

    durationMs

    How long the answer took, in milliseconds, as reported by the backend. This always wins over the gap derived from createdAt.

    Declaration
    public int durationMs
    Field Value
    Type Description
    int

    id

    Stable identifier. Used to decide which message is streaming.

    Declaration
    public string id
    Field Value
    Type Description
    string

    parts

    The message's pieces. Null for a plain-text message.

    Declaration
    public IEnumerable<ChatMessagePart> parts
    Field Value
    Type Description
    IEnumerable<ChatMessagePart>

    role

    Who authored the message.

    Declaration
    public ChatRole role
    Field Value
    Type Description
    ChatRole

    unknownDuration

    The value a duration takes when it was never measured. Kept out of every elapsed display.

    Declaration
    public const int unknownDuration = -1
    Field Value
    Type Description
    int
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)