Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: aare on February 21, 2019, 08:38:29 AM

Title: Passing global variables to sub-fsm
Post by: aare on February 21, 2019, 08:38:29 AM
Hi guys!

I stumbled upon an issue where my global array is not modified by the sub-fsm when passed as an inspector parameter, I'm guessing values are copied upon the call while I wan't to pass it as a reference.

Is there a way to pass global array to sub-fsm such that it'll be modified by it?
Title: Re: Passing global variables to sub-fsm
Post by: djaydino on February 21, 2019, 09:53:17 AM
Hi.
Not sure what you mean by sub fsm.
Title: Re: Passing global variables to sub-fsm
Post by: aare on February 21, 2019, 10:04:09 AM
I mean the fsm started using "Run FSM" action - that's the sub-fsm.
Title: Re: Passing global variables to sub-fsm
Post by: djaydino on February 21, 2019, 10:34:03 PM
Hi.
Ak ok.

I believe at this moment when you place a exposed value (inspector parameter)  it works as an input, not as output.

But if its a 'global' you do not need to pass it through. you should be able to select it directly inside the fsm.

But its recommended to minimal global variables (see this wiki (https://hutonggames.fogbugz.com/default.asp?W1462))

In the PlayMaker Beta version Run Fsm has a major update which makes the Action a lot more useful, as it can input/output/every frame directly + it will also work with 'Owner'.

If you wish, you can request access to PlayMaker Beta to Alex (http://hutonggames.com/playmakerforum/index.php?action=profile;u=3) or Jean (http://hutonggames.com/playmakerforum/index.php?action=profile;u=33)

As it beta, it is not recommended tho to use in real projects :)
Title: Re: Passing global variables to sub-fsm
Post by: aare on February 22, 2019, 10:49:23 AM
Sadly I can't select that global array inside sub-fsm as I want to be able to run it twice on different variables. The workaround I settled on atm is to duplicate blocks in sub-fsm, assign global arrays accordingly, and pass a controlling int variable that branches into correct duplicated block group.

Glat to hear this is being adressed, looking forward to that update!