Quick Start
Basic usage
add a
LightweightAnimatorController
component to the GameObject you want to play animations onto (just like you would with anAnimator
component)add or create .anim files to the list of
Animations
of the component, each with a unique Nameadjust the ACAnimation:
- (optional) adjust the
Settings
of your animations (loop, speed, etc...) - (optional) add Unity events in the xEvents` section
- (optional) adjust the
from your desired script, with a reference to the component, call
animator.PlayAnim("AnimName");
Limitations
- the Lightweight Animator Controller relies on animations being in "Legacy" mode, in the sake of being used without Unity's Animator. If an animation needs to be used with both of them in the same project, you will have to duplicate it, and keep one in "Legacy".
- the Lightweight Animator doesn't support Blend Trees, Avatar Masks, etc. That being said, your project will probably benefit from using the Lightweight Animator Controller. See usecases.
- the Lightweight Animator doesn't support changing/adding Animations during run time. All necessary animations must be set up in the Inspector, and
Initialize()
must be called before being able to callPlayAnimation()
. (Initialize()
is called on Start by default).
How to...
enable "Legacy" on an AnimationClip (to use with the LightweightAnimationController)
- if you have a LightweightAnimationController attached to a gameObject already, you can directly click "Fix Clip", when referencing it
- alternatively, you can use the menu option "Enable Legacy", when rightclicking on the inspector's header when inspecting a Clip (or through the 3 dots menu button)
disable "Legacy" on an AnimationClip (to use with the LightweightAnimationController)
- you can use the menu option "Disable Legacy", when rightclicking on the inspector's header when inspecting a Clip (or through the 3 dots menu button)