[Solved] Are StateMachineBehaviours unique to each GameObject?

Or do GameObjects using the AnimatorController all share the Behaviours?

if I have something like this:

private SpriteRenderer _myCachedVariable;

public override OnStateEnter(Animator animator, ...){
_myCachedVariable = animator.GetComponent<SpriteRenderer>();
}

Will _myCachedVariable be overriden everytime a GameObject enters the state or will each GO get their own cached variable?

They will be shared only if you use this:

2 Likes