Animator Component

If game object need to play Action Clip or Action Manager Clip file, it must mount an Animator Component. Like the following:

In above picture, Animators can have many Action Clip or Action Manager Clip files. It means that a game object can play many Action Clip or Action Manager Clip.
The Action Clip file is generated by Action Editor. The Action Manager Clip file is generated by Action Manager.

API

  • Get action object by action name or index of Animators array.
    Prototype: getAction(nameOrIndex)
    nameOrIndex:action name or index of Animators array
      // get first action
      var action = this.gameObject.Animator.getAction(0);
    
  • Play action.
    Prototype: play(nameOrIndex, targetObject, fromBegin)
    nameOrIndex:Action name or index of Animators array, 0 by default.
    targetObject: Target object who play this action, this Animator's gameObject by default.
    fromBegin: Whether play from begin, true by default.
      // play first action
      this.gameObject.Animator.play();
    
  • Stop action.
    Prototype: stop(nameOrIndex)
    nameOrIndex: Action name or index of Animators array, 0 by default.
      // stop first action
      this.gameObject.Animator.stop();
    

Demo

Action Demo