# Animator component reference

Animator is a component that aggregates Animator Controller and Avatar together and works together on an Entity. Animator has references to Animator Controller and Avatar, and Animator Controller has references to several animation clips used.

Animator supports animation playback, state machine transfer, interruption, animation mixing, controller layer, avatar. IK, physics, and frame animation events are not supported.

# Main API

play(stateName: string | number, layerIndex: number = 0, offset: number = 0, duration: number = 0, fixedDuration: boolean = true)

To play a state directly, you can directly specify a certain time point of the action. It will not affect any parameters. After calling this interface, the state transition judgment logic will still be performed.

getParameter(name: string)

Get a parameter.

getFloat(arg: string)

Get Float Parameter.

setFloat(arg: string, value: number)

Set Float Parameter.

getInteger(arg: string)

Get Integer Parameter.

setInteger(arg: string, value: number)

Set Integer Parameter

getBool(arg: string)

Get Bool Parameter

setBool(arg: string, value: boolean)

Set Bool Parameter

setTrigger(arg: string)

Set Trigger Parameter

resetTrigger(arg: string)

Reset Trigger Parameter

hasState(layerIndex: number, name: string | number)

Is there a state

isInTransition(layerIndex: number)

Is it in transfer

getAnimatorTransitionInfo(layerIndex: number)

Get transfer information

点击咨询小助手