Survival Shooter tutorial: part 2 error

Copying the script directly into Unity.
I get 1 error, and 1 problem. Could be related. Unity 5.0

Error: I got errors saying that the default state is Idle, but there is no reference to “idle” in the PlayerMovement script.
It’s true. We only look at Walking in the if statement.

Problem: When I look at the Animator, I see the box turning blue, and getting checked, every time I hit A,W,S,D.
So I know the bool is working. But… The animations are not in sync. The animations actually play till end. So even if I tap the button, I get the whole animation. Meaning if I stop walking, it will play the full 30 second Idle animation, even if he is walking around.

Help.

2 Likes
  • 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.

You will have to uncheck that same box in several other places, so check your other transitions.

13 Likes

The error is not related to Unity 5. I am currently working through some of the tutorials again in Unity 5 to get comfortable with the changes from Unity 4, and am working on the Survival Shooter right now. I was able to get the player movement working just fine (other than having to check “Has Exit Time”.)

In your Animation Controller, make sure you are going from the green Entry box to an orange Idle, then Transitions back and forth to Move.

2005533--129559--upload_2015-3-7_13-14-24.png

1 Like

Thank you so much for the fast reply.

My Unity 5 does not have that RED exit box.
It does have the GREEN entry. The Entry box was easy to figure out, and caused no issues. It automatically attached itself to whatever I set as Default. The “Has Exit Time” was the bugger.
2006105--129593--Anim_HasExitTime.png
works fine now.

2 Likes

This is a real pain and i can’t solve this error please help me!!! Asset ‘PlayerAC’: Transition in state ‘AnyState’ doesn’t have an Exit Time or any condition, transition will be ignored

I believe you need to add “Die” condition at the bottom of the Inspector panel once you have the Any State state selected.

Thank you I managed to fix it but i have a new problem which is this error
NullReferenceException: Object reference not set to an instance of an object
EnemyAttack.Update () (at Assets/Scripts/Enemy/EnemyAttack.cs:57)

Maybe, reopen the IDE will help. Because i have the same problem, but after reopened the IDE, all works fine.
PS. @Socrates helps me, thanks. The animation works.

From now on. Can we please post in the official thread pinned above? As such, I’m closing this thread.

1 Like