I'm having a very bizarre problem. I have a NavMeshAgent component on the player character. Navigation works fine when in my two individual scenes, without jumping between them. I added script to the player that only called DontDestroyOnLoad. The player hits a trigger area that calls StopPathfinding(), then the level AsyncLoads (single). The game is supposed to move the Player's position to a designated spawn point by changing the Player's transform.position to the spawnPoint's transform.position.
----------
However, once the level loads, the player doesn't move at all despite me checking the script completes. In fact, I can't even move the player with the inspector. No matter what changes I make to the transform in the inspector, be it rotation or position, the player does not visibly change, and the values themselves don't take the changes. I have no other scripts that are touching the player's transform.
----------
I figured out that if I toggle the NavMeshAgent component off, it allows me to move the player again using the transform. However, navigation does not work then, even after I've enabled the component again.
----------
So clearly there's a detail about how NavMeshAgents and the engine work and interact with level changes here that I don't understand. Can someone explain what's going on here?
↧