playMaker

Author Topic: Retain Global Variable values on Load [SOLVED]  (Read 1923 times)

Breadman

  • Full Member
  • ***
  • Posts: 185
  • Derp
Retain Global Variable values on Load [SOLVED]
« on: November 26, 2013, 04:49:49 PM »
I previously asked a question about saving games/level loading, but I've boiled it down to a simpler question:

Is there a method for retaining global variable values (particularly booleans) through level load? I know there is a "don't destroy on load" action, but I'm not sure how to do the same for global variables.

Thanks everyone for your help and guidance!!
« Last Edit: November 30, 2013, 01:30:42 PM by Breadman »

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Retain Global Variable values on Load
« Reply #1 on: November 26, 2013, 05:25:54 PM »
Save the bool as a playerpref, then load on new level.

Breadman

  • Full Member
  • ***
  • Posts: 185
  • Derp
Re: Retain Global Variable values on Load
« Reply #2 on: November 27, 2013, 01:39:09 AM »
Thanks for the tip!

I wasn't able to find a Bool-related player pref, so I'm using a string instead, but it should work the same. Will update once I test it out!

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Retain Global Variable values on Load
« Reply #3 on: November 27, 2013, 03:12:03 AM »
Check out PlayerPrefs X for saving bools

https://hutonggames.fogbugz.com/default.asp?W1118