playMaker

Author Topic: How can I keep my game options saved? [SOLVED]  (Read 773 times)

Silicon Power

  • Junior Playmaker
  • **
  • Posts: 88
    • View Profile
How can I keep my game options saved? [SOLVED]
« 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.   :'(
« Last Edit: September 28, 2017, 11:18:47 PM by djaydino »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4582
    • View Profile
    • jinxtergames
Re: How can I keep my game options saved? (Global variables can't keep changes)
« Reply #1 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

Silicon Power

  • Junior Playmaker
  • **
  • Posts: 88
    • View Profile
Re: How can I keep my game options saved? (Global variables can't keep changes)
« Reply #2 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.
« Last Edit: September 28, 2017, 03:17:47 PM by Silicon Power »

Silicon Power

  • Junior Playmaker
  • **
  • Posts: 88
    • View Profile
Re: How can I keep my game options saved? (Global variables can't keep changes)
« Reply #3 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?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4582
    • View Profile
    • jinxtergames
Re: How can I keep my game options saved? (Global variables can't keep changes)
« Reply #4 on: September 28, 2017, 11:18:07 PM »
Hi,
I would suggest getting the Easy Save asset