Survival Shooter Tutorial - Player Animation Not Playing Correctly
I'm on video #2 of the survival shooter tutorial, using Unity v5.1.2 on OSX Yosemite 10.10.3.
I've completed the PlayerAC animator controller and the PlayerMovement script per the tutorial.
When I hit play to test, the player moves and follows the mouse pointer as expected, but the animations are incorrect. For example, the 'Move' animation is only showing the gun moving (while the original that came with what I imported is showing footsteps), and the 'Idle' animation does not show anything (while the original shows yawning and what not).
I tried recreating the 'PlayerAC' animator controller, and could see the animations working fine within the animator up until I attached it to the player object. I also tried attaching the animator from the '_CompletedAssets' folder, and the same thing occurred (the animations appeared to be working fine until they were attached to the player object).
I'm not seeing any issues come up in the console, and I'm not seeing anything about this online. Anyone out there have any thoughts?
Answer by efreethy · Oct 22, 2016 at 08:00 PM
Expanding on @lvrodrgues 's response, he is correct, the solution can be found here: http://forum.unity3d.com/threads/survival-shooter-tutorial-part-2-error.308208/
Here is the text solution, as posted by @Socrates:
Open the Animator Controller. In the Animator window, select the Transition from Idle to Move. In the Inspector, uncheck "Has Exit Time". This prevents the rest of the animation loop from playing before you transition to the next animation.
This makes sense actually, if you don't give the animation any time to complete before triggering the next animation, the player will go from idle -> to walking -> back to idle almost instantaneously because Input.GetAxisRaw from the PlayerMovementScript is feeding either 0 or 1;
Answer by JehtBlack · Oct 27, 2015 at 11:41 PM
I had the same issue, I found that I had ended up with an animator component on both the player game objects in the hierarchy, having one on both caused the player model to fail to animate while gun continued to animate, removing the animator from the model fixed the issue.
Go to the transition between IDLE and $$anonymous$$OVE and un-check exit time. It works perfectly for me.
Thank you #sathyamurthy it's working perfectly.
Answer by lvrodrgues · Jan 07, 2016 at 11:46 AM
Hi. Founded solution in http://forum.unity3d.com/threads/survival-shooter-tutorial-part-2-error.308208/
Answer by ckeaney · Aug 30, 2015 at 01:56 PM
Update:
I still have the same issue, but I've tried and ruled out a couple more things.
1) The 'Player' pre-fab under completed assets that came with the tutorial works as expected when dropped into the scene.
2) I took the script that I wrote for 'PlayerMovement' and applied it to the working pre-fab above, and it continued to work as expected. So I can rule out an issue with my script.
I compared the completed pre-fab asset to the one I had set up, and made sure every setting, as well as the order of all the components was the same, to no avail.
Is it possible this is just a bug within the tutorial?
Answer by steambucky · Sep 26, 2015 at 01:35 AM
@ckeaney - I'm having the same issue. Did you find a solution?
@ckeaney - I fixed this by going to the transition between IDLE and $$anonymous$$OVE and un-ticking exit time.
I am guessing that exit time allows your to finish your animation state before transitioning to the next state rather than just cutting to it straight away. We want the animation to play straight away.
Hope that helps. Only took me an hour to work that out....:) ( I better get use to that....)
So unfortunately, I didn't have exit time checked on any of the transitions and was still experiencing the issue.
I ended up forging forward with the completed pre-fab asset ins$$anonymous$$d to get through the rest of the tutorial (which created a few other complications down the line which I had to sort out).
Glad it worked out for you and appreciate the response and follow up!
Hey,i have a problem, i hope you would reply soon. I am new to unity, that exit time unchecked work, now my problem is my player doesn't gets hurt after adding enemy attack and player health script, or i can say player health bar doesn't decreases when the enemy attack or comes near But... But.. When i simply built and run, on playing outside unity it worked. That health bar responded and the player health also worked as it should be. So. $$anonymous$$y question is why isn't this working inside the unity editor
Your answer
Follow this Question
Related Questions
Animation using Mecanim tutorials 0 Answers
Animator is not playing an AnimatorController 8 Answers
What are some good tutorials/programs for animating? 2 Answers
Animation Control by Float 2 Answers
Problem of trancicion of states with the anystate, mecanim 0 Answers