AddState
Utility function to add a state to the state machine.
Read time 1 minuteLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEditor.Animations
- Assembly: UnityEditor
AddState(string)
Utility function to add a state to the state machine.
public AnimatorState AddState(string name)
Parameters
The name of the new state.
Returns
Type | Description |
|---|---|
| AnimatorState | The AnimatorState that was created for this state. |
Remarks
The state asset that is created is added as a sub asset of the state machine. The API returns an AnimatorState which you can use to add transitions.
An example showing usage of this API can be found at the AnimatorController page.
AddState(string, Vector3)
Utility function to add a state to the state machine.
public AnimatorState AddState(string name, Vector3 position)
Parameters
Returns
Type | Description |
|---|---|
| AnimatorState | The AnimatorState that was created for this state. |
Remarks
The state asset that is created is added as a sub asset of the state machine. The API returns an AnimatorState which you can use to add transitions.
An example showing usage of this API can be found at the AnimatorController page.
AddState(AnimatorState, Vector3)
Utility function to add a state to the state machine.
public void AddState(AnimatorState state, Vector3 position)
Parameters
Remarks
This function pushes an Undo operation.