PlayerController and NavMesh Errors


(Sergey Ryabchenko) #1

Hi I have 4 errors.How to resolve it?

 1.   "SetDestination" can only be called on an active agent that has been placed on a NavMesh.
    UnityEngine.AI.NavMeshAgent:set_destination(Vector3)
    plyGame.PlayerTopDownNavController:RequestMoveTo(Vector3, Boolean) (at D:/Work/u50/_SOURCE_/plyRPG/Game/Character/Player/PlayerTopDownNavController.cs:224)
    plyGame.Character_RequestMoveTo_plyBlock:Run(BlockReturn) (at D:/Work/u50/_SOURCE_/plyRPG/Blocks/Character/CharaControllers/Character_RequestMoveTo_plyBlock.cs:59)
    plyBloxKit.plyBlock:RunChildren() (at D:/Work/u50/_SOURCE_/plyBlox/plyBlock.cs:111)

2. "SetDestination" can only be called on an active agent that has been placed on a NavMesh.
UnityEngine.AI.NavMeshAgent:SetDestination(Vector3)
plyGame.PlayerTopDownNavController:RequestMoveTo(Vector3, Boolean) (at D:/Work/u50/_SOURCE_/plyRPG/Game/Character/Player/PlayerTopDownNavController.cs:225)
plyGame.Character_RequestMoveTo_plyBlock:Run(BlockReturn) (at D:/Work/u50/_SOURCE_/plyRPG/Blocks/Character/CharaControllers/Character_RequestMoveTo_plyBlock.cs:59)
plyBloxKit.plyBlock:RunChildren() (at D:/Work/u50/_SOURCE_/plyBlox/plyBlock.cs:111)


3.NullReferenceException: Object reference not set to an instance of an object
            plyGame.PlayerBaseController.HandleClickSelect () (at D:/Work/u50/_SOURCE_/plyRPG/Game/Character/Player/PlayerBaseController.cs:457)
            plyGame.PlayerBaseController.UpdateActions () (at D:/Work/u50/_SOURCE_/plyRPG/Game/Character/Player/PlayerBaseController.cs:245)
            plyGame.PlayerBaseController.Update () (at D:/Work/u50/_SOURCE_/plyRPG/Game/Character/Player/PlayerBaseController.cs:225)
            plyGame.PlayerTopDownNavController.Update () (at D:/Work/u50/_SOURCE_/plyRPG/Game/Character/Player/PlayerTopDownNavController.cs:98)

(Francois) #2

Hey kotya!

Which version of Unity are you using?


(Sergey Ryabchenko) #3

2017.1.1f1 Personal


(Francois) #4

I had the same issue using 2017.2. Not sure if you are up to it but maybe try updating to 2017.3? Working like a charm for me.


(Sergey Ryabchenko) #5

If I update unity with my project, will it work?


(Francois) #6

That’s for you to find out? :slight_smile: Be sure to back up your project.


(Helgard de Barros) #7

Kotya, it is best to keep updating Unity as the official releases come out. If you update with every release (after making backups before you do) you might get small errors or plugins that don’t work, but you can usually fix those. It is better to keep updating as you go along, because if Unity makes a change later that you need, like a bug fix, it will be a lot harder to go from one version, skip a lot of releases, and jump to a much later version. Then you might run into a whole of of things that you have to update at once and that might break your game.


(Leslie Young) #8

That error should not be caused by Unity version difference.

You are requesting an NPC to move when its navigation control is inactive or it is not on a NavMesh. I’ll ask the obvious, did you bake a NavMesh for the area this NPC is moving on?

Even more worrying is the nullref you get at error 3. That error should not happen since it is during the player character’s normal update loop and means it can not find the camera. It looks like you did not set this scene up correctly.


(Sergey Ryabchenko) #9

I baked a NavMesh.I don’t use Character Camera…I use a static camera…

Also I updated Unity and there is still the error…

"SetDestination" can only be called on an active agent that has been placed on a NavMesh.
UnityEngine.AI.NavMeshAgent:set_destination(Vector3)
plyGame.PlayerTopDownNavController:RequestMoveTo(Vector3, Boolean) (at D:/Work/u50/_SOURCE_/plyRPG/Game/Character/Player/PlayerTopDownNavController.cs:224)
plyGame.Character_RequestMoveTo_plyBlock:Run(BlockReturn) (at D:/Work/u50/_SOURCE_/plyRPG/Blocks/Character/CharaControllers/Character_RequestMoveTo_plyBlock.cs:59)
plyBloxKit.plyBlock:RunChildren() (at D:/Work/u50/_SOURCE_/plyBlox/plyBlock.cs:111)
plyBloxKit.ElseCondition_plyBlock:Run(BlockReturn) (at D:/Work/u50/_SOURCE_/plyBlox/Blocks/Flow/Conditions/ElseCondition_plyBlock.cs:30)
plyBloxKit.plyBlock:RunChildren() (at D:/Work/u50/_SOURCE_/plyBlox/plyBlock.cs:111)
plyBloxKit.IfCondition_plyBlock:Run(BlockReturn) (at D:/Work/u50/_SOURCE_/plyBlox/Blocks/Flow/Conditions/IfCondition_plyBlock.cs:28)
plyBloxKit.plyEvent:Run() (at D:/Work/u50/_SOURCE_/plyBlox/plyEvent.cs:78)
plyBloxKit.plyBlox:RunEvent(plyEvent) (at D:/Work/u50/_SOURCE_/plyBlox/plyBlox.cs:643)
Lyn.OnClickTriggerBloxEvent:Click(HandlerType, PointerEventData) (at Assets/plyoung/plyBlox/Components/OnClickTriggerBloxEvent.cs:270)
Lyn.OnClickTriggerBloxEvent:OnPointerUp(PointerEventData) (at Assets/plyoung/plyBlox/Components/OnClickTriggerBloxEvent.cs:68)
UnityEngine.EventSystems.EventSystem:Update()

(Leslie Young) #10

If you look at the scripts the error came from (in that error message) you will note the error originate from you asking the player character to move somewhere,

It all starts during an IF/Else Blocks inside a Blox responding on plyGame/Misc/OnClick Trigger BloxEvent event.

If you disabled control of the character before this happens then it will error. If you are asking for a destiniation that has no path then it will error. Maybe show what you are doing in that event.