PlayMaker News > General Discussion
save and load [SOLVED]
amandaip:
hi guys, how to I keep a game object to be destroyed forever on a scene (scene 1) when I switch to another scene and then come back to scene 1 again? something to do with player preferences? how to I set it up? please if you can help. struggling with this problem. I'm a new beginner. thanks
jeanfabre:
Hi,
you need to flag the object using the action "don't destroy on load" action.
Bye,
Jean
amandaip:
I appreciate your reply, but i think u are teaching me something different. I want the game object to be saved as destroy, not holding it for other scenes. thanks
djaydino:
Hi,
There are many ways you can achieve this,
A way you can do this is by using a bool variable, when the object is destroyed, set it to true
you can use playerprefs to save the bool but its very easy to hack.
If you want more safety you can get easy save for example.
also if you save/load with playerprefs or easy save, it is saved even when you restart the game.
if you only need it to be destroyed in the current game (so not restarting the game)
You could use a global variable instead
On the other scene you need to do a bool test to see if the object is destroyed,
if so you can destroy or disable the object.
For bigger projects that might not be the best way to do this btw.
Then you will need to learn about Scenes and loading parts of scenes.
amandaip:
thanks so much. i think i may try your way first and see how it goes. very good explanation. :)
Navigation
[0] Message Index
[#] Next page
Go to full version