Quantcast
Channel: Questions in topic: "dontdestroyonload"
Viewing all articles
Browse latest Browse all 416

NavMeshAgent (with DoNotDestroyOnLoad) Not Work After LoadScene; Transform Locked

$
0
0
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?

Viewing all articles
Browse latest Browse all 416

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>