playMaker

Author Topic: "Sets" of PlayerPrefs? [SOLVED]  (Read 2231 times)

Breadman

  • Full Member
  • ***
  • Posts: 185
  • Derp
"Sets" of PlayerPrefs? [SOLVED]
« on: November 30, 2013, 02:00:28 PM »
I'm using PlayerPrefs to "save" the player's progress throughout the game. It basically just stores the character's location when a checkpoint is reached, and maintains any characters that have been unlocked. I recently learned that PlayerPrefs will retain their information even when the game closes, so that's great!

I'm curious if there are methods for creating "sets" of player prefs, or in other words, different "saved games" so that there can be multiples within the game, which can then be loaded from a start menu depending on who's playing the game.
« Last Edit: December 03, 2013, 11:56:10 PM by Breadman »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3999
  • Official Playmaker Support
    • LinkedIn
Re: "Sets" of PlayerPrefs?
« Reply #1 on: November 30, 2013, 03:36:10 PM »
There's nothing built it, but you could add the name of the player to the key whenever you access the playerpref (e.g., "player1.position", "player2.position")

Also I remember seeing some PlayerPref extensions around somewhere... might be worth a search...

Breadman

  • Full Member
  • ***
  • Posts: 185
  • Derp
Re: "Sets" of PlayerPrefs?
« Reply #2 on: November 30, 2013, 04:05:47 PM »
Thanks!

I may just have only one "save" per game/owner, but if I do decide to go with multiple saved games, I will look into using multiple keys, or possibly an extension.

Thanks again!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: "Sets" of PlayerPrefs?
« Reply #3 on: December 02, 2013, 02:18:40 AM »
Hi,

 you should definitly look into a proper framework for this like:

http://whydoidoit.com/unityserializer/

bye,

 Jean

Breadman

  • Full Member
  • ***
  • Posts: 185
  • Derp
Re: "Sets" of PlayerPrefs?
« Reply #4 on: December 03, 2013, 11:55:58 PM »
Hi Jean!

I actually stumbled across this exact solution as well - a very enticing solution.

I'm being a purist and trying to see if I can get what I need just out of PlayMaker and scripts (I already used one 3rd party plugin for pause functionality, naughty me).

If doing that fails, I will most likely go with the one you shared!