Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

[Solved] Are StateMachineBehaviours unique to each GameObject?

Discussion in 'Animation' started by Deleted User, Apr 14, 2017.

  1. Deleted User

    Deleted User


    Or do GameObjects using the AnimatorController all share the Behaviours?

    if I have something like this:

    Code (CSharp):
    1. private SpriteRenderer _myCachedVariable;
    3. public override OnStateEnter(Animator animator, ...){
    4. _myCachedVariable = animator.GetComponent<SpriteRenderer>();
    5. }
    Will _myCachedVariable be overriden everytime a GameObject enters the state or will each GO get their own cached variable?
  2. mikael_juhala


    Mar 9, 2015