playMaker

Author Topic: PlayerPrefs "HasKey" not working? [SOLVED]  (Read 3520 times)

Breadman

  • Full Member
  • ***
  • Posts: 185
  • Derp
PlayerPrefs "HasKey" not working? [SOLVED]
« on: December 01, 2013, 02:12:03 AM »
I have my PlayerPrefs working pretty well now. I have one weird issue though, not sure if it's a bug?

I have a sphere, that on touch, uses a "playerprefs set string" action. It gives the player a key titled "Pkey".

I have a cube that has the "playerprefs has key" action on it. When the player has the key "Pkey", the cube is supposed to become invisible. But it doesn't! it keeps returning false after the check.

The cube's purpose was to debug a suspicion that the "has key" check wasn't working on a different FSM.

Is this a known issue? Or am I missing something [a very likely possibility]?
« Last Edit: December 05, 2013, 01:46:45 AM by Breadman »

caesarhernandez

  • Playmaker Newbie
  • *
  • Posts: 30
Re: PlayerPrefs "HasKey" not working?
« Reply #1 on: December 01, 2013, 09:40:57 PM »
Hi,

This seems to be working for me. What I did:

- created two cubes with FSMs and MousePickEvent actions
- cube 1 has MouseDown setting PlayerPrefsSetKey using "Pkey"
- cube 2 has MouseDown checking PlayerPrefsHasKey with true and false events
- the true event gets fired.

Are you sure the PlayerPrefsHasKey is getting fired after the PlayerPrefsSetKey?

Breadman

  • Full Member
  • ***
  • Posts: 185
  • Derp
Re: PlayerPrefs "HasKey" not working?
« Reply #2 on: December 05, 2013, 01:46:26 AM »
Turns out I was storing the key in a global variable, using "get key", in the wrong state of my FSM.

Thank you!!