Lightweight Animator Controller
  • Manual
  • Scripting API
Search Results for

    Show / Hide Table of Contents
    • ACLightweightAnimator
      • LightweightAnimatorController
    • ACLightweightAnimator.Core
      • ACAnimation
      • ACAnimationEvents
      • ACAnimationLayer
      • ACAnimationSettings

    Class LightweightAnimatorController

    the LightweightAnimatorController is an alternative to the Animator component, with better performances, but with fewer options

    Inheritance
    object
    LightweightAnimatorController
    Namespace: ACLightweightAnimator
    Assembly: cs.temp.dll.dll
    Syntax
    public class LightweightAnimatorController : MonoBehaviour

    Properties

    Animations

    All the animations that you want to use on this gameObject

    Declaration
    public List<ACAnimation> Animations { get; }
    Property Value
    Type Description
    List<><ACAnimation>

    AutoPlayAnimationName

    Declaration
    public string AutoPlayAnimationName { get; }
    Property Value
    Type Description
    string

    AutoPlayOnStart

    if set to true, the animation specified by name will be automatically played

    Declaration
    public bool AutoPlayOnStart { get; }
    Property Value
    Type Description
    bool

    CullingType

    If the animator should play animations when not rendered. see AnimationCullingType

    Declaration
    public AnimationCullingType CullingType { get; }
    Property Value
    Type Description
    AnimationCullingType

    Initialized

    Declaration
    public bool Initialized { set; }
    Property Value
    Type Description
    bool

    the initialization state of the LightweightAnimatorController

    InitializedOnAwake

    if set to false, you will need to manually call Initalize(). Otherwise Intialize() will be called at Awake

    Declaration
    public bool InitializedOnAwake { get; }
    Property Value
    Type Description
    bool

    Methods

    GetAnimationClips(List<AnimationClip>)

    Used by Unity's Animation window to preview animtions set in Animations field of the LightweightAnimatorController

    Declaration
    public void GetAnimationClips(List<AnimationClip> results)
    Parameters
    Type Name Description
    List<><AnimationClip> results

    GetAnimationProgress(ACAnimation)

    returns the progress (between 0 and 1) of the animation

    Declaration
    public float GetAnimationProgress(ACAnimation anim)
    Parameters
    Type Name Description
    ACAnimation anim

    animation

    Returns
    Type Description
    float

    -1 if animName is unknown, or a value between 0 and 1

    GetAnimationProgress(string)

    returns the progress (between 0 and 1) of the animation

    Declaration
    public float GetAnimationProgress(string animName)
    Parameters
    Type Name Description
    string animName

    the name of the animation

    Returns
    Type Description
    float

    -1 if animName is unknown, or a value between 0 and 1

    Initialize()

    Method to call to initialize all animations and being ready to Play and Stop them. Can be automatcally called on Start using the initializedOnStart setting in the Inspector

    Declaration
    public void Initialize()

    PlayAnimation(string, Action)

    Plays an animation by name (definied in the animations field), based on the Advanced Settings setup in the Controller For example:

    void Start()
    {
        void HighlightCompleted()
        {
            Debug.Log("Highlight animation just finished");
        }
    
        animator.PlayAnimation("Highlight", HighlightCompleted());
    }

    will look for the animation named "Highlight" and play it with the parameters set in the inspector for this animation. It will then call HighlightCompleted() when it reached the end of the animation.

    Declaration
    public void PlayAnimation(string animName, Action onAnimationCompleted)
    Parameters
    Type Name Description
    string animName

    Animation's name set in the Controller

    Action onAnimationCompleted

    a Method to callback once animation has been played (will not be called if animation is Stopped before it reaches the end)

    PlayAnimation(string)

    Plays an animation by name (definied in the animations field), based on the Advanced Settings setup in the Controller For example:

    animator.PlayAnimation("Highlight");

    will look for the animation named "Highlight" and play it with the parameters set in the inspector for this animation

    Declaration
    public void PlayAnimation(string animName)
    Parameters
    Type Name Description
    string animName

    Animation's name set in the Controller

    StopAnimation(string)

    Stops an animation by name (definied in the animations field

    Declaration
    public void StopAnimation(string animName)
    Parameters
    Type Name Description
    string animName

    Animation's name set in the Controller

    In This Article
    Back to top Lightweight Animator Controller version 1.0 by Antoine Cherel