{"id":13664364,"url":"https://github.com/ashblue/unity-animator-helpers","last_synced_at":"2025-07-21T08:32:59.176Z","repository":{"id":26657082,"uuid":"109467036","full_name":"ashblue/unity-animator-helpers","owner":"ashblue","description":"A micro-framework for changing Unity 3D's Animator parameters with ScriptableObject(s). Designed to make going from custom scripts to Animator parameters easy. Works with 2D or 3D projects.","archived":false,"fork":false,"pushed_at":"2023-04-19T10:08:41.000Z","size":934,"stargazers_count":137,"open_issues_count":10,"forks_count":14,"subscribers_count":19,"default_branch":"develop","last_synced_at":"2025-07-08T11:06:02.918Z","etag":null,"topics":["animation","animator","micro-framework","scriptableobject","unity","unity2d","unity3d"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ashblue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-11-04T04:33:10.000Z","updated_at":"2025-06-05T19:05:53.000Z","dependencies_parsed_at":"2024-01-11T14:12:00.489Z","dependency_job_id":"59ac489a-08e2-48d9-9e80-dd6e22d10069","html_url":"https://github.com/ashblue/unity-animator-helpers","commit_stats":{"total_commits":43,"total_committers":1,"mean_commits":43.0,"dds":0.0,"last_synced_commit":"c2d12f3d092af0c2a8401074a6f93efa926b014b"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ashblue/unity-animator-helpers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashblue%2Funity-animator-helpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashblue%2Funity-animator-helpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashblue%2Funity-animator-helpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashblue%2Funity-animator-helpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ashblue","download_url":"https://codeload.github.com/ashblue/unity-animator-helpers/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashblue%2Funity-animator-helpers/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266267290,"owners_count":23902334,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["animation","animator","micro-framework","scriptableobject","unity","unity2d","unity3d"],"created_at":"2024-08-02T05:02:54.231Z","updated_at":"2025-07-21T08:32:59.159Z","avatar_url":"https://github.com/ashblue.png","language":"C#","funding_links":[],"categories":["C\\#","Open Source Repositories","C#","Open Source Packages"],"sub_categories":["Animation"],"readme":"# Unity Animator Helpers\n\nEver had to handle complex animations that require multiple frames such as jump, attack, or receiving damage? Generally this results in messy Animator variables and repeated code. Unity Animator Helpers provides a micro-framework to create modular animations that can be visually programmed and modularly shared between GameObjects.\n\n* Create animator variable changes from a ScriptableObject with visual programming\n* Share animator playback variable changes between GameObject(s)\n* Wait for multiple animator variable changes from a coroutine or loop\n* Pre-made library of common Animator Behaviors for visually programming the Animator with variable changes and randomization  \n\n**Support**\n\nJoin the [Discord Community](https://discord.gg/8QHFfzn) if you have questions or need help.\n\n## Quickstart\n\n### AnimatorPlayback Objects\n\nHow to use the `AnimatorPlayback` object to play animations with variables.\n\n![Preview of Playback Helper](/playback-helper-example.png)\n\n1. Right click in the project window\n1. Go to Create -\u003e ADNC -\u003e Animator Variables -\u003e Animator Playback\n1. Set your variables and true conditions on the object\n1. Attach the object to a MonoBehavior as so `AnimatorPlayback playback;`\n1. Call `playback.Play(MY_ANIMATOR);` to trigger the variables.\n\nExample script.\n\n```c#\npublic class AnimatorPlaybackExample : MonoBehaviour {\n    private Animator anim;\n    \n    [SerializeField]\n    private AnimatorPlayback _completeEvent;\n\n    [SerializeField]\n    private string _completeMessage = \"Detected animation playback as complete\";\n\n    private void Start () {\n        anim = GetComponent\u003cAnimator\u003e();\n\n        // To play with a coroutine that waits for the conditions\n        StartCoroutine(DetectEventComplete());\n        \n        // To play without any coroutine or wait conditions\n        // _completeEvent.Play(anim);\n    }\n\n    IEnumerator DetectEventComplete () {\n        yield return _completeEvent.PlayCoroutine(anim);\n        Debug.Log(_completeMessage);\n    }\n}\n```\n\nNote that the AnimatorPlayback objects are fully unit and runtime tested\ndue to their level of complexity.\n\n#### Features\n   \n   * AnimatorPlayback objects to easily detect animation completion conditions\n   * Pre-built library on AnimatorBehavior(s) for complex animation playback\n   * Animator extensions that add missing functionality to Unity's Animator component\n   * Animator unit testing helper (for editor only tests)\n   * Unit tested\n\n### Installation\n\nUnity Animator Helpers is used through [Unity's Package Manager](https://docs.unity3d.com/Manual/CustomPackages.html). In order to use it you'll need to add the following lines to your `Packages/manifest.json` file. After that you'll be able to visually control what specific version of Unity Animator Helpers you're using from the package manager window in Unity. This has to be done so your Unity editor can connect to NPM's package registry.\n\n```json\n{\n  \"scopedRegistries\": [\n    {\n      \"name\": \"NPM\",\n      \"url\": \"https://registry.npmjs.org\",\n      \"scopes\": [\n        \"com.fluid\"\n      ]\n    }\n  ],\n  \"dependencies\": {\n    \"com.fluid.unity-animator-helpers\": \"2.0.0\"\n  }\n}\n```\n\n### Releases\n\nArchives of specific versions and release notes are available on the [releases page](https://github.com/ashblue/unity-animator-helpers/releases).\n\n#### Nightly Builds\n\nTo access nightly builds of the `develop` branch that are package manager friendly, you'll need to manually edit your `Packages/manifest.json` as so. \n\n```json\n{\n    \"dependencies\": {\n      \"com.fluid.unity-animator-helpers\": \"https://github.com/ashblue/unity-animator-helpers.git#nightly\"\n    }\n}\n```\n\nNote that to get a newer nightly build you must delete this line and any related lock data in the manifest, let Unity rebuild, then add it back. As Unity locks the commit hash for Git urls as packages.\n\n### Development Environment\n\nIf you wish to run to run the development environment you'll need to install the latest [node.js](https://nodejs.org/en/). Then run the following from the root once.\n\n`npm install`\n\nIf you wish to create a build run `npm run build` from the root and it will populate the `dist` folder.\n\n#### Making Commits\n\nAll commits should be made using [Commitizen](https://github.com/commitizen/cz-cli) (which is automatically installed when running `npm install`). Commits are automatically compiled to version numbers on release so this is very important. PRs that don't have Commitizen based commits will be rejected.\n\nTo make a commit type the following into a terminal from the root\n\n```bash\nnpm run commit\n```\n\n## Other Helper Libraries\n\n### Animator Behaviors\n\nThere are several animator helper scripts to assist you with Animator Behavior(s).\nThese are aimed at allowing you to interact with the Animator without having to write\nadditional scripts to tweak variables and playback.\n\n![Preview of Playback Helper](/animator-helpers.png)\n\n#### Available Helpers\n\nHere is a brief list of helpers. New ones will be added as the repo is updated over time.\n\n* SetVarBool\n* SetVarRandomBool\n* SetVarFloat\n* SetVarRandomFloat\n* SetVarInt\n* SetVarRandomInt\n* RandomSpeed\n* RandomStartTime\n\nSee documentation on methods (in code) for complete details.\n\n### Animator Extensions\n\nUnity Animator Helpers extends the pre-existing functionality of Unity3D's built in `Animator` component with static\nextensions. This doesn't hurt or break any existing functionality. For example you could do the following to check if \nyou have a particular bool parameter.\n\n```c#\npublic class AnimatorExtensionExample : MonoBehaviour {\n    private Animator anim;\n    \n    public string hasAnimatorBool = \"myBool\";\n    \n    private void Start () {\n        anim = GetComponent\u003cAnimator\u003e();\n        \n        Debug.LogFormat(\"Animator has bool {0}: {1}\", hasAnimatorBool, anim.HasBool(hasAnimatorBool));\n    }\n}\n``` \n\n#### Available Animator extensions\n\n* HasParameter(name)\n* HasBool(name)\n* HasFloat(name)\n* HasInt(name)\n* HasTrigger(name)\n\nSee documentation on methods (in code) for complete details.\n\n### Extension Caching \nAnimator extensions perform some caching to make lookups instant. This only happens on the first extension\ncall per unique `AnimatorController`. While this generally shouldn't cause performance problems and is almost instant. \nYou may need to call `AnimatorHelperRuntime.Instance.Cache(Animator)` on `Start` or `Awake` if your `Animator(s)` \nhave over 300 parameters. Please note that your `AnimatorController` object (what you pass into the Animator via \ninspector) must be uniquely named in order for the caching to work correctly.\n\n### Animator Unit Test Helper\n\nThis library provides an `AnimatorStub` (editor only) class that makes testing animations via pure code super simple.\nAll you need to do is the following.\n\n```c#\nusing Adnc.AnimatorHelpers.Editors.Testing.Utilities;\nusing NUnit.Framework;\nusing UnityEngine;\n\npublic class TestAnimatorStub {\n    private AnimatorStub _stub;\n    \n    [SetUp]\n    public void Setup () {\n        _stub = new AnimatorStub();\n    }\n\n    [TearDown]\n    public void Teardown () {\n        // The stub is attached to a GameObject, so it must be destroyed manually\n        Object.DestroyImmediate(_stub.Animator.gameObject);\n    }\n    \n    [Test]\n    public void MyTest () {\n        // Setup your AnimatorController as desired\n        stub.AnimatorCtrl.AddParameter(\"myBool\", AnimatorControllerParameterType.Bool);\n        \n        // Inject a runtime version of the AnimatorController with all of your settings\n        stub.InjectCtrl();\n        \n        // Test as normal\n        // stub.Animator.Update(10); // If you need to simulate time\n        Assert.IsTrue(stub.Animator.HasBool(\"myBool));\n    }\n}\n```\n\n---\n\nThis project was generated with [Oyster Package Generator](https://github.com/ashblue/oyster-package-generator).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashblue%2Funity-animator-helpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashblue%2Funity-animator-helpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashblue%2Funity-animator-helpers/lists"}