Class ChatPlan
The Plan tool's review card: what the agent intends to do, and the two answers to it.
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
[UxmlElement]
public class ChatPlan : BaseVisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder
Remarks
The card is three bands. The header carries the plan title, the optional source path and the optional edit and expand controls. The body scrolls the plan itself, which the caller supplies as children — typically a rendered markdown view. The footer pairs a status line with Discard and Run plan.
Editing is deliberately not owned here. editable only offers the control and isEditing only reflects which mode is showing; the caller swaps the body for an editor, because only it knows what the plan is made of.
Every control is a package component: IconButton for the header affordances and Button for the footer pair, so the card inherits their sizing and focus behaviour rather than restating it.
Examples
A plan with an expand control and both footer actions wired.
var plan = new ChatPlan
{
title = "Megaman clone",
filePath = "Assets/Plans/megaman-clone.md",
expandable = true
};
plan.Add(new MarkdownView { content = planMarkdown });
plan.runRequested += RunPlan;
plan.discardRequested += DiscardPlan;
parentElement.Add(plan);
In UXML. Children land in the scrolling body.
<appui:ChatPlan title="Megaman clone" file-path="Assets/Plans/megaman-clone.md" editable="true">
<appui:Text text="1. Add a player controller" />
</appui:ChatPlan>
Constructors
ChatPlan()
Default constructor.
Declaration
public ChatPlan()
Fields
actionsUssClassName
The styling class of the footer's action group.
Declaration
public const string actionsUssClassName = "appui-chat-plan__actions"
Field Value
| Type | Description |
|---|---|
| string |
bodyUssClassName
The styling class of the scrolling body.
Declaration
public const string bodyUssClassName = "appui-chat-plan__body"
Field Value
| Type | Description |
|---|---|
| string |
defaultStatus
The default footer status line.
Declaration
public const string defaultStatus = "Plan ready to execute"
Field Value
| Type | Description |
|---|---|
| string |
discardButtonUssClassName
The styling class of the Discard button.
Declaration
public const string discardButtonUssClassName = "appui-chat-plan__discard-button"
Field Value
| Type | Description |
|---|---|
| string |
editButtonUssClassName
The styling class of the edit control.
Declaration
public const string editButtonUssClassName = "appui-chat-plan__edit-button"
Field Value
| Type | Description |
|---|---|
| string |
editingUssClassName
The styling class applied while the body is showing an editor.
Declaration
public const string editingUssClassName = "appui-chat-plan--editing"
Field Value
| Type | Description |
|---|---|
| string |
expandButtonUssClassName
The styling class of the expand control.
Declaration
public const string expandButtonUssClassName = "appui-chat-plan__expand-button"
Field Value
| Type | Description |
|---|---|
| string |
filePathUssClassName
The styling class of the source path.
Declaration
public const string filePathUssClassName = "appui-chat-plan__file-path"
Field Value
| Type | Description |
|---|---|
| string |
footerUssClassName
The styling class of the footer band.
Declaration
public const string footerUssClassName = "appui-chat-plan__footer"
Field Value
| Type | Description |
|---|---|
| string |
headerIconUssClassName
The styling class of the header's leading glyph.
Declaration
public const string headerIconUssClassName = "appui-chat-plan__header-icon"
Field Value
| Type | Description |
|---|---|
| string |
headerUssClassName
The styling class of the header band.
Declaration
public const string headerUssClassName = "appui-chat-plan__header"
Field Value
| Type | Description |
|---|---|
| string |
runButtonUssClassName
The styling class of the Run plan button.
Declaration
public const string runButtonUssClassName = "appui-chat-plan__run-button"
Field Value
| Type | Description |
|---|---|
| string |
statusIconUssClassName
The styling class of the status glyph.
Declaration
public const string statusIconUssClassName = "appui-chat-plan__status-icon"
Field Value
| Type | Description |
|---|---|
| string |
statusLabelUssClassName
The styling class of the status text.
Declaration
public const string statusLabelUssClassName = "appui-chat-plan__status-label"
Field Value
| Type | Description |
|---|---|
| string |
statusUssClassName
The styling class of the footer status group.
Declaration
public const string statusUssClassName = "appui-chat-plan__status"
Field Value
| Type | Description |
|---|---|
| string |
titleUssClassName
The styling class of the plan title.
Declaration
public const string titleUssClassName = "appui-chat-plan__title"
Field Value
| Type | Description |
|---|---|
| string |
ussClassName
The ChatPlan main styling class.
Declaration
public const string ussClassName = "appui-chat-plan"
Field Value
| Type | Description |
|---|---|
| string |
Properties
contentContainer
The plan body. This is what Add reaches.
Declaration
public override VisualElement contentContainer { get; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
Overrides
discardButton
The footer's Discard button.
Declaration
public Button discardButton { get; }
Property Value
| Type | Description |
|---|---|
| Button |
editButton
The header's edit control.
Declaration
public IconButton editButton { get; }
Property Value
| Type | Description |
|---|---|
| IconButton |
editable
Whether the edit control is offered. False by default, which makes the plan read-only.
Declaration
[CreateProperty]
[UxmlAttribute]
public bool editable { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
expandButton
The header's expand control.
Declaration
public IconButton expandButton { get; }
Property Value
| Type | Description |
|---|---|
| IconButton |
expandable
Whether the expand control is offered. False by default.
Declaration
[CreateProperty]
[UxmlAttribute]
public bool expandable { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
filePath
Where the plan lives, for instance "Assets/Plans/megaman-clone.md". Null or empty hides the element entirely rather than leaving a gap in the header.
Declaration
[CreateProperty]
[UxmlAttribute]
public string filePath { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
isEditing
Whether the body is currently showing an editor rather than the rendered plan. Purely reflective: setting it does not change the body, it only marks the card and flips the edit control to its pressed state.
Declaration
[CreateProperty]
[UxmlAttribute]
public bool isEditing { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
runButton
The footer's Run plan button.
Declaration
public Button runButton { get; }
Property Value
| Type | Description |
|---|---|
| Button |
status
The footer status line. "Plan ready to execute" by default.
Declaration
[CreateProperty]
[UxmlAttribute]
public string status { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
title
The plan title shown in the header.
Declaration
[CreateProperty]
[UxmlAttribute]
public string title { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Events
discardRequested
Raised when the user discards the plan.
Declaration
public event Action discardRequested
Event Type
| Type | Description |
|---|---|
| Action |
editRequested
Raised when the user toggles editing. The caller owns the resulting mode change.
Declaration
public event Action editRequested
Event Type
| Type | Description |
|---|---|
| Action |
expandRequested
Raised when the user asks to open the plan full screen.
Declaration
public event Action expandRequested
Event Type
| Type | Description |
|---|---|
| Action |
runRequested
Raised when the user runs the plan.
Declaration
public event Action runRequested
Event Type
| Type | Description |
|---|---|
| Action |