- Home /
How do I keep objects destroyed between scenes?
For example:
Player is in Scene A or Level 1 and there are 100 collectible "coins" in Scene A
The player then collects 50 or a number of these coins leaving 50 coins left
Then, the player leaves to another area or different scene, Scene B.
Eventually, the player returns to Scene A
How do I make the scene only have the 50 coins the player didn't collect rather than it resetting to 100 coins?
btw, I'm using JavaScript in my project if there is a coding solution.
Similar question to this one have been asked in the last year. One solution I remember is PlayerPrefs or ArrayPrefs2 from the Unity Wiki. Essentially each time a coin is destroyed, its destruction is marked. When the scene is reloaded, each coin checks it state and disables/destroys itself if necessary.
Answer by FirePlantGames · May 09, 2014 at 03:29 AM
I'm not sure I understand, but could this be what you mean?