playMaker

Author Topic: Array values not updating when using Get Next  (Read 2609 times)

indeed

  • Junior Playmaker
  • **
  • Posts: 85
Array values not updating when using Get Next
« on: September 01, 2019, 02:16:56 PM »
Hi I can't get array values to update and I'm just curious if this is a known issue. I've tried with an Int array and a Bool array. Changes made using Array Get Next (set all bools to True, or Add 1) do not update the values in either array. And I don't think it's a Unity display issue because the scene also reacts to the new values as if they're unchanged. I tried adding the "Array Save Changes" action between every step with no effect.

You can see in this screenshot that curiously the value (+1 added to an Int of 0) updates in the "Result" variable but not in the array itself. Apologies if I'm missing something obvious.

Unity 2018.2.19f1
Playmaker 1.9.0 p18
OS X 10.14.5

Athin

  • Full Member
  • ***
  • Posts: 163
Re: Array values not updating when using Get Next
« Reply #1 on: September 01, 2019, 11:08:37 PM »
Heya,

I feel like you may not be using the action correctly but I can't tell from the picture.  Can you link all the FSM in the picture so I can see how your set up is?

Array get next just finds the first Index you got listed (having it set to 0 grabs the first on the list) and stores that value.  You want it to flow into another state to then use that value and apply your logic (setting Bool to true or adding 1 ect).  Then the state can flow back into the get next action for it to grab the next one in the list.


indeed

  • Junior Playmaker
  • **
  • Posts: 85
Re: Array values not updating when using Get Next
« Reply #2 on: September 01, 2019, 11:18:06 PM »
Sure, here is a screenshot of the setup showing the next state

Athin

  • Full Member
  • ***
  • Posts: 163
Re: Array values not updating when using Get Next
« Reply #3 on: September 01, 2019, 11:31:37 PM »
Heya,

On the array component itself, do you have "Live Feed" check off?(Or something Live can't remember whats it called off the top of me head) 

I just re-read your issue and realize you were getting the right int but the array wasn't updating.

indeed

  • Junior Playmaker
  • **
  • Posts: 85
Re: Array values not updating when using Get Next
« Reply #4 on: September 01, 2019, 11:49:57 PM »
Oh, maybe this is the issue.... There is no component. I just created an array within playmaker variables. Am I supposed to manually add a component to the Game Object?

Athin

  • Full Member
  • ***
  • Posts: 163
Re: Array values not updating when using Get Next
« Reply #5 on: September 02, 2019, 12:05:29 AM »
That would be it then.  Need to have an array to edit the array :P

You can create arrays on the fly with actions or pre-make them on game objects. 

indeed

  • Junior Playmaker
  • **
  • Posts: 85
Re: Array values not updating when using Get Next
« Reply #6 on: September 02, 2019, 12:27:07 AM »
Sorry I'm confused. Making an an Array variable in the Variables tab of an FSM doesn't create an array?

Athin

  • Full Member
  • ***
  • Posts: 163
Re: Array values not updating when using Get Next
« Reply #7 on: September 02, 2019, 12:32:18 AM »
No I don't believe it does (Although haven't tried it).  I've always premade my arrays or had an action to create one. 

indeed

  • Junior Playmaker
  • **
  • Posts: 85
Re: Array values not updating when using Get Next
« Reply #8 on: September 02, 2019, 09:24:44 AM »
Ah, that's the method I've used the most often. It actually works here with other kinds of operations. For example, if instead in the Next state I use "Array Set", the array correctly updates to the value I choose using the index number. It's as if it can correctly talk to the index number but not the stored variable from the array "Result".

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Re: Array values not updating when using Get Next
« Reply #9 on: September 02, 2019, 01:38:16 PM »
I just tested the Array Get Next action and I am unable to set a value for 'result'.
It's possible this action is broken. Would need a report.
I'm on PM1.9.0.p18 (latest patch).

Sorry I'm confused. Making an an Array variable in the Variables tab of an FSM doesn't create an array?

The Variables tab allows you to create any variable. You just have to set up an Array one properly because you have to define the type of object inside (float by default). Contrary to most other vars, you cannot create an Array from an action. You must go into the Variables tab.

indeed

  • Junior Playmaker
  • **
  • Posts: 85
Re: Array values not updating when using Get Next
« Reply #10 on: September 02, 2019, 01:41:28 PM »
I found a way to make this work, but is this how it's supposed to be? In the "Next" state, if I add an "Array Set" action that assigns the current index value to the "Result" variable, then it correctly stores it in the array. See screenshot.

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Re: Array values not updating when using Get Next
« Reply #11 on: September 03, 2019, 04:25:06 AM »
Yes, that is the way to go. The looping (next) event is meant to lead to a state where you may want to do something with the current result, before returning into the main state that drives the looping sequence until it's finished and you exit this main state with the done event, as you use.