- Home /
Animation plays in preview but not in game
I know this topic has been asked a lot. When I enter the PlayMode the animation doesn´t play. I´ve tried to change the "apply root motion" button and checked if the object is set to static like in similar conversations but it still doesn´t work. The reason of my problem is neither the AnimationController script nor the Animator window because it used to work before. I hope you understood my problem. Do you have any idea? Thanks! Here is a short clip: https://drive.google.com/open?id=1X_IMyyCSbHtwlky1l3ZZkogo9KLuex62
P.S. Two strange things: 1. If I click the object having the animator component attached and enter PlayMode I can see a circle in the scene view moving like my animation should do. The object doesn´t "follow" this circle. Maybe I have to apply the object to the animation somehow. 2. When I put the affected object out of it´s parent and hit play, the object jumps to its old local position. (The transform changes when being a child of a other object) When I watch this object in scene view at its old position it bahaves almost normal. Sometimes it suddenly changes its y-rotation by 180°.
The third picture is in the comments.
Check your animator component. It might be disabled. A gif of what you are experiencing will help !
When I hit play and the animator component is deactivated the "Glock 17" remains at his normal location but no animations are played
Can you show your animation controller and animation what inside?
Did you mean the Animator Window. I don´t think the script and the animator are the problem because you can see bars beneath each component in the animator window when you are in playmode and these bars work perfectly when I press the corrosponding input button
You can make a clip of what happened. Try to show us the Animator window, and what you think may be the problem.
I don´t know how to upload a clip here because the max size is something about 500kb
You can post anywhere, just we can see it. Wait...Why do you pull the gun out of its parent, it may be a problem, I have not done so before.
Answer by RealismWorld · Dec 30, 2017 at 09:01 AM
I finally found the answer why the animation is not playing. The reason is that I used a Animator in the Camera object where I wanted to switch between two weapons. This doesn´t seem to work for Unity.