Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Silicon Power on September 27, 2017, 05:19:03 PM

Title: How can I keep my game options saved? [SOLVED]
Post by: Silicon Power on September 27, 2017, 05:19:03 PM
Hey guys, let say for example my game has an option to select between gamepad or keyboard controllers and everything is good except I can't save this options! so everytime I close game I must re-setup all options again because my global variable can't save its value.   :'(
Title: Re: How can I keep my game options saved? (Global variables can't keep changes)
Post by: djaydino on September 28, 2017, 12:59:55 AM
hi,
For this you can use playerprefs actions.

playerprefs is perfect for this, but not for saving scores/coins/etc... as it is very easy to hack.
It is ideal for preferences :)

so at the start of your game you need to use a 'has key' 1st to see if the key reference exists.
if not you can do a 'default' save.

then if it does exists the you can get the value with a playerprefs get action and if you change the value you need to use playerprefs set actions.

to reset (delete all saved data)  you can use playerprefs  Delete All
Title: Re: How can I keep my game options saved? (Global variables can't keep changes)
Post by: Silicon Power on September 28, 2017, 04:03:00 AM
hi,
For this you can use playerprefs actions.

playerprefs is perfect for this, but not for saving scores/coins/etc... as it is very easy to hack.
It is ideal for preferences :)

so at the start of your game you need to use a 'has key' 1st to see if the key reference exists.
if not you can do a 'default' save.

then if it does exists the you can get the value with a playerprefs get action and if you change the value you need to use playerprefs set actions.

to reset (delete all saved data)  you can use playerprefs  Delete All

Thanks I'm going to test it soon, but can't we save a global variable value? I mean there is no way to do this? because I was planed to save all my character choices to global variables.
Title: Re: How can I keep my game options saved? (Global variables can't keep changes)
Post by: Silicon Power on September 28, 2017, 03:17:06 PM
Ok playerprefs method works good for this section. But what if we going to create a big database of saved values?
Title: Re: How can I keep my game options saved? (Global variables can't keep changes)
Post by: djaydino on September 28, 2017, 11:18:07 PM
Hi,
I would suggest getting the Easy Save (https://www.assetstore.unity3d.com/en/#!/content/768) asset