Animation Controller
Select the node in Hierarchy panel where you need to apply the animation graph, and then click Add Component -> Animation -> Animation Controller below in Inspector panel to add an animation controller component to the node.
Programmatically Controlling Animation Graphs
The animation controller component provides a number of methods for controlling the Animation State Machine of the animation graph at runtime.
Method | Description | |
---|---|---|
Get all variables and their names/types/values, etc. | ||
setValue | Set the value of the variable. | getValue</td></tr><tr><td><code>getValue</code></td><td>Get the value of the variable.</td><td> getValue |
getCurrentStateStatus | Get the current state information. | |
getCurrentClipStatuses | Get the current state of the clip. | getCurrentClipStatuses |
getCurrentTransition | Get the current state transition. | |
getNextStateStatus | Get information about the next state. | getNextStateStatus</td></tr><tr><td><code>getNextClipStatuses</code></td><td>Get the status of the next animation clip.</td><td> setLayerWeight |
setLayerWeight | Set the weight of a certain . |
Variable Control
For example, we have a variable in the Animation Graph Panel added several variables, the code can get and modify the value of the variables, the code example is as follows.
Get the current transition