Class: AnimatorComponent
Runs an animation graph (.animgraph asset) on the entity's AnimationComponent: plays the entry state's clip, then follows transitions as parameters change and clips reach their exit times. Gameplay code drives it through the parameters:
animator.SetBool('running', true);
animator.SetTrigger('jump');
AnimatorSystem does the work (Update phase, before AnimationSystem). The AnimationComponent's own Play On Load should be off — the graph decides what plays.
Extends
Constructors
Constructor
ts
new AnimatorComponent(): AnimatorComponent;Returns
AnimatorComponent
Inherited from
Properties
| Property | Modifier | Type | Default value | Inherited from |
|---|---|---|---|---|
dirty | public | boolean | true | Component.dirty |
enabled | public | boolean | true | Component.enabled |
graph | public | string | undefined | - |
Methods
GetBool()
ts
GetBool(name): boolean;Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
boolean
GetCurrentState()
ts
GetCurrentState(): string | null;Returns
string | null
GetNumber()
ts
GetNumber(name): number;Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
number
IsInState()
ts
IsInState(name): boolean;Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
boolean
OnStateEnter()
ts
OnStateEnter(cb): AnimatorUnsubscribe;Parameters
| Parameter | Type |
|---|---|
cb | (state, previous) => void |
Returns
Play()
ts
Play(state): void;Jumps straight to a state (next tick), skipping transitions.
Parameters
| Parameter | Type |
|---|---|
state | string |
Returns
void
ResetTrigger()
ts
ResetTrigger(name): void;Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
void
SetBool()
ts
SetBool(name, value): void;Parameters
| Parameter | Type |
|---|---|
name | string |
value | boolean |
Returns
void
SetNumber()
ts
SetNumber(name, value): void;Parameters
| Parameter | Type |
|---|---|
name | string |
value | number |
Returns
void
SetTrigger()
ts
SetTrigger(name): void;Held until a transition consumes it (or ResetTrigger).
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
void