Search Unity

Animator Controller on Inactive Objects

Discussion in 'Animation' started by Gizmoi, Feb 10, 2015.

  1. Gizmoi

    Gizmoi

    Joined:
    Jan 9, 2013
    Posts:
    327
    When I set a GameObject to inactive using SetActive, the animation stops. Rightly so.
    However when I enable the GameObject again, it is left in a limbo state because it never completed its animation. Parts of it are left on, half-alpha'd etc.

    Is this intended behaviour? If so, how can I get it to 'snap' to the first frame, or last frame of an animation?

    I should mention I'm using Mecanim and new uGUI elements.
     
  2. mark_gr

    mark_gr

    Joined:
    Jan 16, 2015
    Posts:
    26
    Ive got the same problem, figured it would get fixed since it seems like a pretty serious problem but havint seen anything in the patch notes.

    Ive had varying success with adding a component that Rebinds the animator on OnEnable but it definitely does not work all the time.

    Havint been able to find anyone that has gotten it completely fixed as well.

    Hope to get some info on how to fix it because its a pretty big issue for us.
     
  3. Gizmoi

    Gizmoi

    Joined:
    Jan 9, 2013
    Posts:
    327
    What do you mean by rebinds?
    My Animator doesn't lose reference to it's controller if that's what you mean?

    Short of making a 'Reset' animation for each clip to reset the positions, alphas etc. back to their original values and play that in OnEnable, I can't think of a way around it that would work in every case.
     
  4. mark_gr

    mark_gr

    Joined:
    Jan 16, 2015
    Posts:
    26
    the animator has a rebind function, but it doesint actually fix the problem, just makes it a little less worse in my case.

    Like you said, having some kind of "reset" animation is the only sure fix for now, but if you have multiple layers in your animator it can be tricky getting all the variables set correctly... also you should not have to do the extra work so hoping it gets fixed.(or at least an acceptable workaround)
     
  5. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    Please log a bug. It should be deterministic