- Home /
Walking between scenes
Hello, i need help with walking between two scenes. I need to force my character to go from "town" scene to "swamps" scene. I Know ho to do that. What i actualy need is to make my character appear at the gate when he transfers from the "swamp" scene back to "town" and vice versa.
I know i should use a DontDestroyOnLoad. But i cant make it work. It just duplicates the player and i am ending up with more and more copies as i go throurh the scenes.
I need the dont destroyed player to apply as main player and somehow destroy the transfered one.
If someone could put here an easy script. I know its lot to ask but I am limited by deadline because this game is a school project.
And also please pardon my english its not my native language.
Thank you in advance.
Answer by Hi There · Mar 26, 2013 at 04:22 PM
you should use a singleton. probably you have an instance of the player in the scene you are trying to load. When a second player gets there from the previous scene, you get two copies of the player. A singleton would avoid that behaviour. Check tip #29 in the following : http://devmag.org.za/2012/07/12/50-tips-for-working-with-unity-best-practices/