|
2 | 2 |
|
3 | 3 | A micro-framework for changing Unity 3D's Animator parameters with ScriptableObject(s). Designed to make going from
|
4 | 4 | custom scripts to Animator parameters easy. Works with 2D or 3D projects.
|
| 5 | + |
| 6 | +## Quick Start Guide |
| 7 | + |
| 8 | +### AnimatorPlayback Objects |
| 9 | + |
| 10 | +How to use an AnimatorPlayback to play animations with variables. |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +1. Right click in the project window |
| 15 | +1. Go to Create -> ADNC -> Animator Variables -> Animator Playback |
| 16 | +1. Set your variables and true conditions on the object |
| 17 | +1. Attach the object to a MonoBehavior as so `AnimatorPlayback playback;` |
| 18 | +1. Call `playback.Play(MY_ANIMATOR);` to trigger the variables. |
| 19 | + |
| 20 | +Example script. |
| 21 | + |
| 22 | +```c# |
| 23 | +public class AnimatorPlaybackExample : MonoBehaviour { |
| 24 | + private Animator anim; |
| 25 | + |
| 26 | + [SerializeField] |
| 27 | + private AnimatorPlayback _completeEvent; |
| 28 | + |
| 29 | + [SerializeField] |
| 30 | + private string _completeMessage = "Detected animation playback as complete"; |
| 31 | + |
| 32 | + private void Start () { |
| 33 | + anim = GetComponent<Animator>(); |
| 34 | + |
| 35 | + // To play with a coroutine that waits for the conditions |
| 36 | + StartCoroutine(DetectEventComplete()); |
| 37 | + |
| 38 | + // To play without any coroutine or wait conditions |
| 39 | + // _completeEvent.Play(anim); |
| 40 | + } |
| 41 | + |
| 42 | + IEnumerator DetectEventComplete () { |
| 43 | + yield return _completeEvent.PlayCoroutine(anim); |
| 44 | + Debug.Log(_completeMessage); |
| 45 | + } |
| 46 | +} |
| 47 | +``` |
| 48 | + |
| 49 | +Note that the AnimatorPlayback objects are fully unit and runtime tested |
| 50 | +due to their level of complexity. |
| 51 | + |
| 52 | +## Animator Behaviors |
| 53 | + |
| 54 | +There are several animator helper scripts to assist you with Animator Behavior(s). |
| 55 | +These are aimed at allowing you to interact with the Animator without having to write |
| 56 | +additional scripts to tweak variables and playback. |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | +### Available Helpers |
| 61 | + |
| 62 | +Here is a brief list of helpers. New ones will be added as the repo is updated over time. |
| 63 | + |
| 64 | +* SetVarBool |
| 65 | +* SetVarRandomBool |
| 66 | +* SetVarFloat |
| 67 | +* SetVarRandomFloat |
| 68 | +* SetVarInt |
| 69 | +* SetVarRandomInt |
| 70 | +* RandomSpeed |
| 71 | +* RandomStartTime |
0 commit comments