Monday, 14 July 2014

The Importance of Nothing

Just a quick tip for this article.

I have a lot of layers in my Unity Mecanim Controller which I turn on and off as needed by setting the weight to one and then usually fade that back out to zero when no longer needed.  The layers are typically for upper body only movements like reloading or throwing.

I had struggled with unexpected jerky starts when the layer was enabled.

I eventually realised that there is a mandatory default animation on each layer.  In the layers where it was useful to transition from Any State, the behaviour of the controller is to immediately start the default state, which causes the jump and then start the transition from that incorrect state to the desired state.

Armed with that information I simply added a default state that does not have an animation.  It does nothing and has no transitions but that fixed it.