Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: remolino on April 08, 2021, 05:56:08 PM

Title: Global variables don't work.
Post by: remolino on April 08, 2021, 05:56:08 PM
I been using Playmaker a logn time ago and I think is a good asset. However. Since the begining of this month my global variables dont work with my prefabs.

My case is very simple I have a gloval variable "aButton" and I used for interact with other fsm and it was working without any problem. but now my prefabs don't detect the global variable. But if I create a normal object (not a prefab) the global variable works. Any know the reason? what can I do for my prefab detect the Global variable?   :-\ :-\ :-\ :-\

Hope there's anyone outhere that can help me.
Title: Re: Global variables don't work.
Post by: Weak Interactive on April 09, 2021, 12:55:54 AM
Unfortunately, I have no idea why that's happening, and hopefully someone comes by with a solution.

However, I strongly recommend not using Global Variables at all. I used to use them, and it was nothing but headache after headache with all the issues I experienced.

It's much more reliable to store those variables in an FSM on a regular game object (a game manager or something similar), and access those variables via "Find Object" and "Get/Set FSM [Variable]." If you put that object in your first scene, and attach a "Don't Destroy on Load" action to one of its FSMs, you can access it from any scene in your game.

Good luck with your project, and I hope whatever you decide to do works out.
Title: Re: Global variables don't work.
Post by: Alex Chouls on April 09, 2021, 01:56:08 PM
What version of Unity and PlayMaker are you using?

We fixed a bug with globals and prefabs in 1.9.1p4.
There's another fix that might be related in 1.9.1p5 currently in beta.

Are you able to share your project? If so please PM or email me. Thanks!