Skip to content

format

typescript
Animator.Play(name, layer_index, normalized_time_offset)

class: Animator

description

Switches the animation state to the specified animation state and plays it immediately.

parameter

param_nametypedescription
namestringThe name of the specified animation state.
layer_indexnumber?The index of the layer.
normalized_time_offsetnumber?The time offset in normalized time.

reture

typedescription
void

code example

typescript
let obj = new GameObject();
let animator = obj.AddComponent<Animator>(Animator);
animator.Play("name",0,1);