playMaker

Author Topic: Player Prefs not saving High Score after Application Quit  (Read 977 times)

OddButAwesome

  • Playmaker Newbie
  • *
  • Posts: 46
    • View Profile
Player Prefs not saving High Score after Application Quit
« on: October 19, 2015, 08:48:28 AM »
Hi all,

Having an issue as per the subject line.

I have a button in the top right X that has the FSMs as follows:
- Check Button
- Player Prefs Set High
- Quit Application.

While the game is running the high score is displayed and updated correctly whenever a new score beats it. When I quit using the X button or task switch and restart the game the score is set to 0.

Can anyone see something wrong in my setup?

Thank you.

Cyborg_Sam

  • Playmaker Newbie
  • *
  • Posts: 11
    • View Profile
Re: Player Prefs not saving High Score after Application Quit
« Reply #1 on: October 19, 2015, 08:52:26 AM »
Hi

I have been trying to work this out for the past week!
Hopefully someone can point us in the right direction :)

 

OddButAwesome

  • Playmaker Newbie
  • *
  • Posts: 46
    • View Profile
Re: Player Prefs not saving High Score after Application Quit
« Reply #2 on: October 19, 2015, 09:01:30 AM »
Hi Cyborg_Sam,

I was just looking at your post on the similar issue :).

I got my high score to save across scenes (Gameplay, MainMenu) by using a Global Variable to store the score. Not sure if this makes a difference or not and it looks like you are using a totally different system with the txt file but maybe it may help you.

I am still learning the ropes with PM.

Cheers

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 2265
    • View Profile
    • jinxtergames
Re: Player Prefs not saving High Score after Application Quit
« Reply #3 on: October 19, 2015, 10:26:05 PM »
Hi,
on your playerprefs Action take out the global from the key value and name them (for example) CurrentHiSave.

atm your global/currenthighSTRING is changing value and playerprefs can't find your save

the "key value" is to find your playerprefs save value

OddButAwesome

  • Playmaker Newbie
  • *
  • Posts: 46
    • View Profile
Re: Player Prefs not saving High Score after Application Quit
« Reply #4 on: October 19, 2015, 10:33:24 PM »
Thank you djdino!

I will give that a shot.