add_state
Add a top-level state to a StateTree asset, then compile and save it. If the state name already exists, no duplicate is created and the result reports that it already existed.
Instructions
Add a top-level state (a new SubTree, never a child of another state) to a StateTree asset, then compile and save it. Idempotent: if any state already has that name nothing changes and already_existed is true. Returns state_count, added and saved.
Returns: { tree_path, state_name, state_count, already_existed, added, saved }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tree_path | Yes | Asset path of the StateTree, e.g. "/Game/AI/ST_Guard". | |
| state_name | Yes | Name of the new state, e.g. "Patrol"; the other state commands find states by this name. |