- Home /
Is there a way to return all your viaraibles and script to the way it was when the game started
Hi,i am just wondering if there is anyway to restart all the code that is written down because every time i play my game, its fine but when i finish the game and want to play again, all of the events that have occurred in the first run, does not restart and the level loads as if i just completed it. Anyway of fixing this problem? Thanks!
That's not how Unity works; look at your setup and see if you have things being saved, or give a very specific example
@getyour441, for example, i have this piece of text that the player reads and when he has finished reading it, it deactivates. So after finishing the game, i press play again (in game and not from the unity editor), the text is not there. This applies to a lot of objects in the game.
Well that bit about 'in game and not Editor' changes the whole question. So now look at the places you've used DontDestroyOnLoad
weirdly enough, i haven't used DontDestroyOnLoad. I've used Application.LoadLevel - that is it.
You might want to use the $$anonymous$$onoDev Solution Search to verify that. If it's truly not there, please share a bit of code that might better illustrate this.