Search Unity

Survival Shooter tutorial: part 2 error

Discussion in 'Community Learning & Teaching' started by fishZombie, Mar 7, 2015.

Thread Status:
Not open for further replies.
  1. fishZombie

    fishZombie

    Joined:
    Apr 28, 2014
    Posts:
    8
    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.
     
    ghamrian and Mr-B like this.
  2. Socrates

    Socrates

    Joined:
    Mar 29, 2011
    Posts:
    787
    1. Open the Animator Controller.
    2. In the Animator window, select the Transition from Idle to Move.
    3. 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.
     
  3. Socrates

    Socrates

    Joined:
    Mar 29, 2011
    Posts:
    787
    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.

    upload_2015-3-7_13-14-24.png
     
    rafaelfaturi likes this.
  4. fishZombie

    fishZombie

    Joined:
    Apr 28, 2014
    Posts:
    8
    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.
    Anim_HasExitTime.png
    works fine now.
     
    rafaelfaturi and SevenMD like this.
  5. BarneytheDinoDuck

    BarneytheDinoDuck

    Joined:
    Jul 17, 2015
    Posts:
    7
    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
     
  6. Kezia

    Kezia

    Joined:
    May 10, 2014
    Posts:
    1
    I believe you need to add "Die" condition at the bottom of the Inspector panel once you have the Any State state selected.
     
  7. BarneytheDinoDuck

    BarneytheDinoDuck

    Joined:
    Jul 17, 2015
    Posts:
    7
    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)
     
  8. qiaosangning

    qiaosangning

    Joined:
    Mar 9, 2016
    Posts:
    1
    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.
     
  9. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    From now on. Can we please post in the official thread pinned above? As such, I'm closing this thread.
     
Thread Status:
Not open for further replies.