Search Unity

NullReferenceException: Object reference not set to an instance of an object

Discussion in 'Navigation' started by imichalakis, May 8, 2022.

  1. imichalakis

    imichalakis

    Joined:
    Apr 29, 2022
    Posts:
    1
    While watching this tutorial
    , I am trying to build an RTS Game and I am doing exactly what he is doing. I haven't got any personal knowledge in unity. After building the script about NavMesh and add exactly the code in the video when I click right - click to move my unit, I am getting the error:


    NullReferenceException: Object reference not set to an instance of an object
    MP.CPG.Units.Player.PlayerUnit.MoveUnit (UnityEngine.Vector3 _destination) (at Assets/_Scripts/PlayerUnit.cs:21)
    MP.CPG.InputManager.InputHandler.HandleUnitMovement () (at Assets/_Scripts/InputHandler.cs:110)
    MP.CPG.Player.PlayerManager.Update () (at Assets/_Scripts/PlayerManager.cs:20)

    For your information, I go to window->AI-Navigation and clicked on bake