Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Something changed: mecanim now traverses tree at moment of instantiation?

Discussion in 'Animation' started by Sinaz20, Jan 13, 2016.

  1. Sinaz20

    Sinaz20

    Joined:
    Nov 16, 2009
    Posts:
    53
    We occasionally use a gating state with non-exit time, zero duration transitions to establish starting states when objects are instantiated in code.

    Before some recent update, what would happen is we'd have one line of code instantiate the game object, then the next line of code apply the params necessary to get that object into it's appropriate start state for the situation.

    It seemed before that the instantiated object would not traverse it's tree until the end of the current block of code.

    Now, the newly instantiated object traverses the tree at the moment of instantiation-- meaning it is already past the gating state based on the default parameters-- before we even execute the very next line of code to set the necessary parameters.

    This change broke several of our animations overnight, and I can't figure out a way to beat this change without overly complicated changes to code or animators.

    Has anyone else encountered this and come up with a working strategy? Might this be considered a bug?

    See the attachment -- it shows the New State, which is empty, branching with two transitions. The transition looks for whether "Spawn" is true or not. This parameter gets set immediately in code after instantiation. Before some update, this sort of gating worked.

    The associated files haven't changed since mid october, yet the behavior began breaking sometime this last week (we just updated from 5.3.0p[something] to 5.3.1p2.

    Thanks for any help.

    EDIT: We used some deeper logging to confirm this. New object completely traverses its tree at the moment of instantiation preventing code from injecting any starting state parameters.

    Mecanim-Problem.png
     
    Last edited: Jan 13, 2016