playMaker

Author Topic: Save different keys by levels to playerprefs [SOLVED]  (Read 764 times)

mooblegum

  • Playmaker Newbie
  • *
  • Posts: 18
Save different keys by levels to playerprefs [SOLVED]
« on: October 12, 2020, 11:42:45 AM »
Hello everyone,
I am struggling to understand how to save for each levels differents informations.
For example:
Like a mario game, on each levels there is 3 stars to collect, I would like to save the number of stars collected to player prefs so that on the level select screen I could show for each scenes how many stars the player has collected.
I know how to save to playerprefs but how could I save for each levels a different player prefs key? like level01Stars, level02Stars ....
Is there a way to automaticaly detect the scene name maybe?
Thank you!
« Last Edit: October 12, 2020, 04:26:35 PM by djaydino »

heavygunner

  • Sr. Member
  • ****
  • Posts: 344
Re: Save different keys by levels to playerprefs
« Reply #1 on: October 12, 2020, 01:53:42 PM »
Try build string action and use the result as key

mooblegum

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Save different keys by levels to playerprefs
« Reply #2 on: October 12, 2020, 03:09:37 PM »
Thank you Heavygunner!
I didn't know about this action, I guess I could then retrieve the current scene build number, and use it in the string to use as the key.
This seem clever!! Thank you so much  :D

PS: Just tested, work perfectly!!
« Last Edit: October 12, 2020, 04:12:53 PM by mooblegum »