Search Unity

Survival Shooter tutorial - Lesson 4. Creating Enemy #1 issue [Solved]

Discussion in 'Scripting' started by alber_developer, Sep 7, 2017.

  1. alber_developer

    alber_developer

    Joined:
    Jul 2, 2016
    Posts:
    16
    Hello, I'm new in Unity and I'm doing this tutorial (Survival Shooter tutorial) with Unity 2017.1.0f3

    At the end of the lesson, setting movement script to the enemy, the console throws me this error:

    "SetDestination" can only be called on an active agent that has been placed on a NavMesh.
    UnityEngine.AI.NavMeshAgent:SetDestination(Vector3)
    EnemyMovement:Update() (at Assets/Scripts/Enemy/EnemyMovement.cs:25)

    Please, help me to solve it!

    Thanks a lot!
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    If you Google for this error with this tutorial, you'll find your answer.
     
    Kurt-Dekker likes this.
  3. alber_developer

    alber_developer

    Joined:
    Jul 2, 2016
    Posts:
    16
    Hello, I searched Google before with no results, but I researched it and I've found the solution. It was:

    Hey guys,


    For the Navigation, I guess that we have missed sth. Before clicking the "bake" button, we should choose the environment in Hierarchy first. Otherwise, Unity doesn't know what you want to brake at all. Thus, the enemy is locked up aat doorway. If you choose environment in hierarchy, the rebrake. It works. I hope that this commnet is useful. Thanks.

    From this link: http://answers.unity3d.com/questions/920178/survival-shooter-tutorial-fix-for-unity-5.html

    Thank you anyway
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    FYI I had originally searched Google for "survival shooter SetDestination can only be called on an active agent that has been placed on a NavMesh" which returns that link as the 2nd result.