- Home /
Loading back and forth between levels, creates clone of player
Hello Everyone,
I am working on a game where the main character can choose which quest to go on, from his town. The player is already in the town on startup. Once he selects the quest, it loads a new level for him to quest on. I use the DontDestroyOnLoad.
The problem is, that once he finishes his quest, it loads back to the town, also using DontDestroyOnLoad, but as a result there are now two players in the town.
I was wondering how to make it so that it only loads the one character between levels. I need it to save the info from the character who returned from the quest, since he may have extra loot to bring back.
Would someone be able to point me in the right direction to help remedy this?
Thank you very much!
Answer by f4bo · Jan 25, 2015 at 11:07 AM
there is an insightful unity training video that talks thoroughly about this argument here
The video mostly talks about loading and saving a game. But for the part for loading a character between levels, it is scripted to delete the newest character, not the oldest, so it deletes the character who just returned from the quest, making the player lose everything he gained...
After a few hours of tweaking, I got it to work. Thank you f4bo.
Your answer
Follow this Question
Related Questions
Level Loading By 3D Text 1 Answer
GetComponent doesn't work 2 Answers
How to get rid of the duplicates created by DontDestroyOnLoad? 3 Answers
DontDestroyOnLoad duplication 1 Answer
Loading Screen? 6 Answers