Firstly, I have a DontDestroy script on the player.
Secondly, I have a door which sends the player from scene 1 to scene 2, and a door in scene 2 which sends the player to scene 1. My player starts in scene 1, and when he goes to scene 2 then back to scene 1, there is a clone of him. This probably has to do with the fact that I have the player prefab in scene 1.
Please let me know how to stop this. Any help is greatly appreciated.
It’s a natural consequence of using ‘DontDestroy’. If you can return to the scene where it was created, another one is going to appear.
There are various ways to work around it, the method I like is to make and place a ‘player spawner’ in the scene instead of a player. It checks if a player exist and only creates one if it doesn’t. That way there won’t be a second player when you return to scene 1.
The advantage of this method is you can put player spawners in whatever scene you want for testing and/or savegame support.