playMaker

Author Topic: PlayerPref strings, can't store as global string  (Read 2087 times)

jayhfd

  • Junior Playmaker
  • **
  • Posts: 71
PlayerPref strings, can't store as global string
« on: September 07, 2012, 06:54:56 AM »
Hi,
It seems that its not possible to store playerpref keys as global variables? If you can't do this, I wonder why its possible :)

The problem is, I'm trying to build a string using 3 strings. Each string is taken from a playerpref string.

So what I'm doing exactly is:
Playerprefs set string x 3
Key: Globals/Goal 1, 2 and 3
Value: string var 1, 2 and 3

So this should have just set 3 global string variables as the playerpref keys, using 3 local variables, right?

Next state, I 'get playerpref string' and store them as local variables. The problem is that when I build the string, I get String3String3String3. If I look at the get string bit, it seems to be setting the last string that I get into all 3 variables.

I'm not sure if this is a bug or a misunderstanding I have with storing playerpref keys.

Thanks!
Jay

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: PlayerPref strings, can't store as global string
« Reply #1 on: September 07, 2012, 07:34:24 AM »
Hi,

 I can confirm that this is all working fine, the playerprefs and the build string.

 It's likely that you don't set up the actions right, maybe you are actually reusing the same local variables for each of the three playerprefs, where you should have one variable per playerpref to get each result independantly.

if you could share screenshots or your state actions, that could help us.

 else, I can provide you with a working sample if you can't figure it out.

bye,

 Jean

jayhfd

  • Junior Playmaker
  • **
  • Posts: 71
Re: PlayerPref strings, can't store as global string
« Reply #2 on: September 07, 2012, 08:03:26 AM »
Instead of using the three global string vars to store the keys, I'm just writing each Key name in for now, which solves the problem I was having. I was definitely setting each var as its own separate variable.

Probably no need to fix this at all costs, since I can work around it by just typing in the key names. If I realise I do need to store the global vars I'll certainly make screenshots etc.

Thanks!
Jay