- Home /
Extra frame in simple animations?
I am new to Unity and for my first experiment, I decided to go with a demo of Link from Zelda running around.
For now I am only having the character idle or walk around, with 4 animations for each (idle_right, idle_left, ... , walk right, walk_left, ...). I created 2 sub-state machines (Idling and Walking) and moved the related states which I got from my animations in there.
In order to avoid a billion connections in the Animator, I added two extra empty states called walking and idle. Each one of those transitions to its substates, so walking connects to the four walking animations and idle connects to the four idle animations). Instead of cross connecting each idle animation to all walking animations, I connected them all to walking and vice versa.
In other words, each empty state leads to related non-empty states and each non-empty state leads to the un-related empty state. The rest is done with the parameters walk (bool) and direction (int). I thought it was pretty smart when I did it. If walk is false, any walking animation transitions to the idle animation, which then switches to one of the idle animations, depending on the direction.
My issue is that this extra split second that the animator stays within the two empty states, the sprite set within the layer's sprite rendered appears. If I remove the layer's sprite completely, for that split second, the character disappears.
Now it's too fast, but it's still visible. I tried changing the empty states' speed to 1000 in the Inspector but nothing happened. Can I save it somehow or do I have to connect everything with everything (which is a complete nightmare with the number of animations I'm planning to add)?
If you are curious, you can find the code here: https://github.com/teomaragakis/Walkers
Since you are working with sprites and your animations can sharply change to any state, I would go with legacy animations rather than using mecanim. Tip: http://answers.unity3d.com/questions/591941/unity-43-animating-spriterenderersprite-with-legac.html
@Womrwood, I'm also trying to avoid this, since the Animator is really easy to use and it saves me from writing a ton of code. I'm starting small now, but the thing I'm trying to build will have a ton of animations. There must be some way.
If you find anything, please post it here, I am interested in solutions for these kind of problems too. I switched to legacy almost because of the same issue.
what if you made one of the walking animations the "default walk" and used it in place of your empty walking animation.
you could still branch off to other alternative walks from it.
@jonSG, tried it. The empty states do not load the default state animation, but the default sprite set in the sprite layer. So even if I add a single sprite (for instance idle_down) it will work well on transitions between down-facing animations but on the rest it will just flash an image of the sprite facing down.
Your answer
Follow this Question
Related Questions
SpriteManager 2 1 Answer
Sprite animation 2 Answers
How to make not smooth animation? 0 Answers
Animation System in 4.3 1 Answer