Hello all,
i hope you have a great day, i came up a problem when using NavMesh with Additive Scenes.
Here is what i try to accomplish;
i have a character that i set as NavMesh agent in my first Scene.
when player clikcs a button it calls this function :
Click to See code
But after new scene loaded, when i try to move my character, it throws this Error:
Error
“SetDestination” can only be called on an active agent that has been placed on a NavMesh.
UnityEngine.AI.NavMeshAgent:SetDestination(Vector3)
PlayerMovement:OnGroundClick(BaseEventData) (at Assets/_Scripts/MonoBehaviours/Player/PlayerMovement.cs:89)
UnityEngine.EventSystems.EventSystem:Update()
&&
“Resume” can only be called on an active agent that has been placed on a NavMesh.
UnityEngine.AI.NavMeshAgent:set_isStopped(Boolean)
PlayerMovement:OnGroundClick(BaseEventData) (at Assets/_Scripts/MonoBehaviours/Player/PlayerMovement.cs:90)
UnityEngine.EventSystems.EventSystem:Update()
and here is the my movement script’s related part to this Error :
Click to see code
I am still working on same project since then but i can not really remember how i did solve this problem. but try to move your player to new scene like this " SceneManager.MoveGameObjectToScene(); " hope it helps, if its not . i highly recommend using this navigation system: " https://github.com/Unity-Technologies/NavMeshComponents " if its not too late to change , unfortunately it was too late for me.