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

Turning off Write Defaults seems to do nothing useful

Discussion in 'Animation' started by kineticabstract, Jun 14, 2015.

  1. kineticabstract

    kineticabstract

    Joined:
    Nov 15, 2014
    Posts:
    10
    I have a set of sprites that move across my playing field using physics. The sprites come in various sizes, so I set their transform.localscale as appropriate for that instantiation of the sprite. I have a single animation that I want them to do when a specific condition is met, otherwise, they are not animated. In order to accomplish this, I set up an animator with two states - "SteadyState", and "ThrowAway". The SteadyState state does nothing at all - it has literally no properties, is not set to loop, and "Write defaults" is not checked. It does have a transition, which sends the action to the ThrowAway state when the ThrowAway flag gets set. ThrowAway immediately transitions back to SteadyState when it is complete.

    So I expect that that SteadyState state will do nothing. Unfortunately, it does not do nothing. It sets my object's scale (x and y) to 1. No matter what I do, as long as my Animator is active on my sprite, my scale is 1. When I'm debugging in the UI, if I turn off the Animator for a sprite, it behaves exactly as I expect (except for the animation, of course). When I turn the Animator back on, SteadyState happens, and my scale is now 1 again. I'd be happy to have SteadyState set the scale to whatever that sprite is currently set at, to avoid this issue, but I have to way to tell the state to "Change the scale to whatever it is currently set to." that I can find.

    Please tell me that I'm doing this animation completely wrong, and that I should be doing something else to support the animation that I'd like my sprite to do. This is driving me insane.