Search Unity

Is it possible to count how many States are inside a SubState?

Discussion in 'Animation' started by Shadowing, Mar 10, 2019.

  1. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    Wondering if there is a way to count how any states are inside a SubState in the Animator?
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    In the editor you can cast the RuntimeAnimatorController to a UnityEditor.AnimatorController to get full access to its internals.

    At runtime you can't. You can access some details of the current state and the state being transitioned to, but that's about it.

    You can generally work around this sort of thing by accessing what you need in the editor and serializing a copy of that data it in your script. It's a hacky workaround that takes a bunch of effort to set up, but that's your only real option if you use Mecanim.
     
    awesomedata likes this.