Unity sprite animation change first sprite on loop - unity3d

I have the following sprite animator:
I want to reproduce all 10 sprites on first loop, but on second loop I want to start at sprite number 6. That's because the 5 firsts sprites are from make a good transition to walk to run, but once zombie is runing these sprites look weird to repeat.
Is it posible to do?

As per usual there are many ways to solve this problem. It seems like the easiest way to solve it would be to have three walking animation states. OnStart => Walking => OnStop. Where OnStart and OnStop play a single time. Use all 10 sprites for your on start animation and then use sprites 6-10 for your walking animation. So when your character starts to move it plays the OnStart animation once and transitions straight into the walking animation. For extra credit you could make a stopping animation where similarly when the character stops it plays a one-shot unique animation of the character coming to a stop. If you are attempting to have the complete spectrum from stationary=> walking=> running my suggestion would be to research how to use blend trees. Basically you will end up having an "idle","walking", "running" animation and based on the speed of the character unity will blend those animations together. But my first suggestion would be the simplest.

Related

how to fix Unity 3d Jump animation?

I am new to Unity Game Development. I have a simple question but I am not getting the correct answer anywhere.
I had a player(capsule) that can jump and move. Now I have added a character to it and added animations. The walk and move animations are fine but...
My character is jumping as usual and over that, the animation of jumping is playing so It's looking like a double jump. What to do??
here is a video for better understand : Problem Video
It looks like in the animation the character is crouching in preparation before it does the actual jump. Seems like you could either start playing the animation and have an event in the animation that triggers the actual jump after the crouching is done. Or to avoid that delay, trim off or skip the crouching part from the front of the animation.

How can i create a way for a animation to have root motion for npc

Ok I have a npc script, and I have a walking animation for a character, right now the character just slides to the player while playing the animation, and it does not move with each step that the rig is taking, and just doing the animation in place, while it is sliding to the character, how can i make it so it will move with each step, and also, it is a animation that would make a character take 2 steps, pause, take 2 more steps, so just lining up the timing would not work.
Your need to set the walk animation to loop. Set the trigger/bool in AnimatorController when the character is moving and set it to false it isn't moving.

Unity Animation - Shifting Position Unexpectedly

I'm learning Unity right now, and I want to animate a sprite of Mario running.
I found a spritesheet and have cut out 3 images.
I select my Mario game object and create a new animation
In the animation window, I put in 3 spites at the times I want to animation the run
When I press play, Mario is running, however he is also shifting position a little bit in the X direction but then resetting as the animation loops.
Why would my Mario object be shifting a little bit as part of the animation cycle? Where would I look to see an attached property or behavior that is causing him to do this? Maybe I moved the object while I had record on? I deleted all the associated animation objects and recreated them but Mario is still moving.
I figured it out. I had a pivot point created on a single frame of the sprites. This would screw it up.

Unity 2D Animations: How to implement a jumping + shooting at the same time?

I'm trying to create my first computer game and I'm finding myself spending a lot of time trying to make the transitions between the character animations.
I am trying to make a transition from Jumping to Shooting (which have a different animation). I am making the transition from "Any State" to jumping based on a boolean parameter which is true whenever the character is in the air and I'm making the transition to shooting based on a Trigger paramter. Whenever I'm shooting with my character while in the air, it shows the shooting animation for a moment but make the transition back to the jumping animation before finishing it (I assume because it uses the "Any State" to make the transition back to the jumping animation and not the transition between "ShootHorizontalJump).
How can I make the shooting in air animation finish before going back to jumping?
Thank you for you help :)
My Animator
If you are using an animated Sprite Sheet as an animation, You can not play two animations at the same time.
Otherwise, You can use Animation Layer. It's same on 2D and 3D. Check here.

How can I make the last sprite in an animation play for more than 1 frame?

I have a 2D sprite animation of a waving flag, which I'm playing in a loop.
The problem I'm having is that the Unity Animation Editor is making the last sprite of my animation play for only one frame, whereas I have every other sprite playing for several frames. So when the animation loops back to the beginning, the last sprite transition doesn't look smooth because the last sprite is visible for fewer frames than every other sprite.
Is there a way to increase the number of frames that my last sprite plays for in the Animation Editor? Or is there a different way to handle this problem?
Here's my animation. I circled where the problem is.
Click on the diamond above 0:00 and copy. Then go to 0:24 and paste it. First and last sprites look the same but if not that is the reason for this and what I propose must work.
Note: BugFinder's solution works as well:
adding a keyframe at the end without changing anything is not the same as an empty one..... The sprite value remains the last one