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.

    MethodDescription
    Get all variables and their names/types/values, etc.
    setValueSet the value of the variable.getValue</td></tr><tr><td><code>getValue</code></td><td>Get the value of the variable.</td><td>getValue
    getCurrentStateStatusGet the current state information.
    getCurrentClipStatusesGet the current state of the clip.getCurrentClipStatuses
    getCurrentTransitionGet the current state transition.
    getNextStateStatusGet 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
    setLayerWeightSet 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