@@ -10,7 +10,7 @@ Grab the export package and import it into your Unity project
1010
1111### AnimatorPlayback Objects
1212
13- How to use an AnimatorPlayback to play animations with variables.
13+ How to use the ` AnimatorPlayback ` object to play animations with variables.
1414
1515![ Preview of Playback Helper] ( /playback-helper-example.png )
1616
@@ -52,6 +52,21 @@ public class AnimatorPlaybackExample : MonoBehaviour {
5252Note that the AnimatorPlayback objects are fully unit and runtime tested
5353due to their level of complexity.
5454
55+ ### Features
56+
57+ * AnimatorPlayback objects to easily detect animation completion conditions
58+ * Pre-built library on AnimatorBehavior(s) for complex animation playback
59+ * Animator extensions that add missing functionality to Unity's Animator component
60+ * Animator unit testing helper (for editor only tests)
61+ * Unit tested
62+
63+ #### Requesting Features
64+
65+ Please file a GitHub [ issue ticket] ( https://github.com/ashblue/unity-animator-helpers/issues ) if you'd like to
66+ request a feature.
67+
68+ You can view the current [ roadmap here] ( https://github.com/ashblue/unity-animator-helpers/projects/1 ) .
69+
5570## Animator Behaviors
5671
5772There are several animator helper scripts to assist you with Animator Behavior(s).
@@ -72,3 +87,81 @@ Here is a brief list of helpers. New ones will be added as the repo is updated o
7287* SetVarRandomInt
7388* RandomSpeed
7489* RandomStartTime
90+
91+ See documentation on methods (in code) for complete details.
92+
93+ ## Animator Extensions
94+
95+ Unity Animator Helpers extends the pre-existing functionality of Unity3D's built in ` Animator ` component with static
96+ extensions. This doesn't hurt or break any existing functionality. For example you could do the following to check if
97+ you have a particular bool parameter.
98+
99+ ``` c#
100+ public class AnimatorExtensionExample : MonoBehaviour {
101+ private Animator anim ;
102+
103+ public string hasAnimatorBool = " myBool" ;
104+
105+ private void Start () {
106+ anim = GetComponent <Animator >();
107+
108+ Debug .LogFormat (" Animator has bool {0}: {1}" , hasAnimatorBool , anim .HasBool (hasAnimatorBool ));
109+ }
110+ }
111+ ```
112+
113+ ### Available Animator extensions
114+
115+ * HasParameter(name)
116+ * HasBool(name)
117+ * HasFloat(name)
118+ * HasInt(name)
119+ * HasTrigger(name)
120+
121+ See documentation on methods (in code) for complete details.
122+
123+ ### Extension Caching
124+ Animator extensions perform some caching to make lookups instant. This only happens on the first extension
125+ call per unique ` AnimatorController ` . While this generally shouldn't cause performance problems and is almost instant.
126+ You may need to call ` AnimatorHelperRuntime.Instance.Cache(Animator) ` on ` Start ` or ` Awake ` if your ` Animator(s) `
127+ have over 300 parameters. Please note that your ` AnimatorController ` object (what you pass into the Animator via
128+ inspector) must be uniquely named in order for the caching to work correctly.
129+
130+ ## Animator Unit Test Helper
131+
132+ This library provides an ` AnimatorStub ` (editor only) class that makes testing animations via pure code super simple.
133+ All you need to do is the following.
134+
135+ ``` c#
136+ using Adnc .AnimatorHelpers .Editors .Testing .Utilities ;
137+ using NUnit .Framework ;
138+ using UnityEngine ;
139+
140+ public class TestAnimatorStub {
141+ private AnimatorStub _stub ;
142+
143+ [SetUp ]
144+ public void Setup () {
145+ _stub = new AnimatorStub ();
146+ }
147+
148+ [TearDown ]
149+ public void Teardown () {
150+ // The stub is attached to a GameObject, so it must be destroyed manually
151+ Object .DestroyImmediate (_stub .Animator .gameObject );
152+ }
153+
154+ [Test ]
155+ public void MyTest () {
156+ // Setup your AnimatorController as desired
157+ stub .AnimatorCtrl .AddParameter (" myBool" , AnimatorControllerParameterType .Bool );
158+
159+ // Inject a runtime version of the AnimatorController with all of your settings
160+ stub .InjectCtrl ();
161+
162+ // Test as normal
163+ // stub.Animator.Update(10); // If you need to simulate time
164+ Assert .IsTrue (stub .Animator .HasBool (" myBool));
165+ }
166+ }
167+ ```
0 commit comments