When I hit play to test, my Player is moved

In the editor, before I press play, my Player is by the guards we are supposed to talk with (as you show in your video).

But for some odd reason that I cant figure out, when I press play to test, my Player is moved far away. I actually wind up to the left of the castle, in a bit of a valley. There seems to be no way to leave this area as the NavMesh is not connected to the rest of the village.

Any ideas why and how to fix?

Thx,
Jason

Hi Jason,

This reminds me of the issue we had at the Core RPG course when we talked about saving/loading and the player would move to a random place when loading the game because we set its position from code WHILE the NavMesh Agent was enabled. Maybe that’s the case here too? I can’t think of anything else right now…

Thanks. I never took the base RPG course, but I had noticed that there seems to be a saving component in the game. I will look at the code and the persistent data folder to see if there are any saved PlayerPrefs or JSON files and delete them.

That was it. I deleted the save file in Application.persistentDataPath and it works better.

That is great, glad you worked this one out. I would suggest you try the Core course tough, it will help a lot and it covers some interesting topics too.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms