Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

glm9637/ScriptableAnimator

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
6 Commits
 
 
 
 

Repository files navigation

ScriptableAnimator

Generate a Unity script which allows you to access your Animator values without having to use string variables.

Getting Started

  1. Import the ScriptableAnimator.cs into your Unity Project
  2. Open up your Animator in the Inspector and hit the "Generate Script" Button. This creates a two new Scripts in the Folder "Assets/Generated/Animator" A State.cs, which is just a helper class, and a class with the name of your AnimatorController like "PlayerAnimator.cs"
  3. Add this PlayerAnimator Script to the same Object the Anomator is attached to 4 Done!

Using the Script

Store a Reference in the Script you wan't to use the Animator

using IG.Generated.gAnimator;
...
private PlayerAnimator animator;

  private void Awake()
  {
    animator = GetComponent<PlayerAnimator>();
  }

Setting a Parameter

// set a Trigger
animator.Parameter.SetJump();
// set a value
animator.Parameter.Running = true;

Directly calling a Animation

The scripted Animator stores the animations in the same layered way the animator does, so if you want to call a animation on your "Base" Layer you would call animator.base.attack.Play(); If you use substates you could start the substate with the entrystate exactly the same by calling animator.base.substate.Play(); or play a childstate by calling animator.base.substate.child.Play();

About

Generate a Unity script which allows you to access your Animator values without having to use string variables.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.