Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: stigma on April 05, 2019, 05:02:28 PM

Title: [Solved]Globals variables
Post by: stigma on April 05, 2019, 05: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
Title: Re: Globals variables
Post by: djaydino on April 05, 2019, 07: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
Title: Re: Globals variables
Post by: stigma on April 06, 2019, 05:10:06 AM
I do not understand how we can recover variables after closing the game?
Title: Re: Globals variables
Post by: ElProfessor595 on April 07, 2019, 10: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
Title: Re: Globals variables
Post by: djaydino on April 07, 2019, 10: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)
Title: Re: Globals variables
Post by: stigma on April 09, 2019, 05:30:32 AM
There was a problem with Unity. I deleted the Library folder and the problem disappeared.
Thank you