Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


AddState

Utility function to add a state to the state machine.
Read time 1 minuteLast updated 4 days ago

Definition

AddState(string)

Utility function to add a state to the state machine.
public AnimatorState AddState(string name)

Parameters

name

The name of the new state.

Returns

Type

Description

AnimatorStateThe 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

name

The name of the new state.

position

The position of the state node.

Returns

Type

Description

AnimatorStateThe 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

The state to add.

position

The position of the state node.

Remarks

This function pushes an Undo operation.