Search Unity

AnimatorState.uniqueName alternative?

Discussion in 'Scripting' started by landon912, Mar 4, 2015.

  1. landon912

    landon912

    Joined:
    Nov 8, 2011
    Posts:
    1,579
    AnimatorState.uniqueName has been labeled as obsolete, and this time enforced with a error.

    However, the suggestion of using AnimatorState.name is not a valid option. As you are unable to distiguish between layers.

    Working with very complex state machines we use a sort of "polymorphism" if we want to use programming terms. For example we have an "Aim" state under, "Two Handed", "Single Handed", and "Double Handed".

    Now, we still want to check if it's in an "Aim" state, and need to know of which instance of it that we are in, and this is where AnimatorState.uniqueName used to come into play. However, now it's been removed without an alternative.

    Any idea? Have I missed something?
     
  2. CastleIsGreat

    CastleIsGreat

    Joined:
    Nov 10, 2014
    Posts:
    176
    Last edited: Mar 4, 2015
  3. landon912

    landon912

    Joined:
    Nov 8, 2011
    Posts:
    1,579
    Thanks for the suggestion. However, let me add another layer of complexity, we need all Animation States complied in a single Dictionary with a string as a key.

    This is a semi, optional requirement. However, not being able to comply to this would mean some major refactoring of quite a large code base that relies on this system.