playMaker

Author Topic: [Solved]Globals variables  (Read 161 times)

stigma

  • Junior Playmaker
  • **
  • Posts: 78
    • View Profile
    • Maximages
[Solved]Globals variables
« on: April 05, 2019, 02:02:28 PM »
hello Jean
I can not create global variables anymore. Is there a limit?
I have 270 global variables. When I want to add one in the line "New variable", the name is deleted immediately and the variable is not created.
Thanks

Unity 5.6.2f1 Playmaker 1.8.4f5
« Last Edit: April 09, 2019, 02:31:15 AM by stigma »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4108
    • View Profile
    • jinxtergames
Re: Globals variables
« Reply #1 on: April 05, 2019, 04:18:31 PM »
Hi.
I do not know if there is a limit, but i do know that you should avoid using globals.

i did the same before, but now i usually have only 1 or 2 maximum in a project.

I mostly use get/set sfm action and the are more actions on the ecosystem like fsm add int, fsm bool test, etc.

if i have a variable that needs to be accessible by many objects, then i set a empty object with an fsm (i call it meta) and on play i set that one into a global for easier access.

Have a look at this wiki page :
https://hutonggames.fogbugz.com/default.asp?W1462

stigma

  • Junior Playmaker
  • **
  • Posts: 78
    • View Profile
    • Maximages
Re: Globals variables
« Reply #2 on: April 06, 2019, 02:10:06 AM »
I do not understand how we can recover variables after closing the game?

ElProfessor595

  • Playmaker Newbie
  • *
  • Posts: 8
    • View Profile
Re: Globals variables
« Reply #3 on: April 07, 2019, 07:41:08 AM »
You can use too the action "set fsm variable" (float,bool,etc...) for one object with multiple fsm (for use different variables (other than globals)).

I hope this trick has helped you  ;) bye

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4108
    • View Profile
    • jinxtergames
Re: Globals variables
« Reply #4 on: April 07, 2019, 07:53:56 AM »
Hi,
Not sure what you mean.

Globals are reset the same way as locals when restarting the game.

if you want to save/load values you can use playerprefs but it recommended to use easy save or some other save assets (i my opinion easy save is still the best so far)

stigma

  • Junior Playmaker
  • **
  • Posts: 78
    • View Profile
    • Maximages
Re: Globals variables
« Reply #5 on: April 09, 2019, 02:30:32 AM »
There was a problem with Unity. I deleted the Library folder and the problem disappeared.
Thank you