playMaker

Author Topic: Passing global variables to sub-fsm  (Read 1299 times)

aare

  • Playmaker Newbie
  • *
  • Posts: 5
Passing global variables to sub-fsm
« 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?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Passing global variables to sub-fsm
« Reply #1 on: February 21, 2019, 09:53:17 AM »
Hi.
Not sure what you mean by sub fsm.

aare

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Passing global variables to sub-fsm
« Reply #2 on: February 21, 2019, 10:04:09 AM »
I mean the fsm started using "Run FSM" action - that's the sub-fsm.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Passing global variables to sub-fsm
« Reply #3 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)

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 or Jean

As it beta, it is not recommended tho to use in real projects :)

aare

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Passing global variables to sub-fsm
« Reply #4 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!