playMaker

Author Topic: Clearing Array causes other Actions to lose assigned variables  (Read 1105 times)

diccon

  • Playmaker Newbie
  • *
  • Posts: 10
Clearing Array causes other Actions to lose assigned variables
« on: October 14, 2020, 01:47:09 PM »
I have implemented an system that consumes selects random items and quantities and stores them in arrays for further processing, however I am finding that when I clear the arrays at the end of the updates the variables in some of my actions get set to None which causes the next update to break.

Image 1 shows the add state on the first run through, the consume_item variable is added to the consume_items array correctly



Image 2 shows the clear state which is run at the end of the update, as you can see one item has been added to each array



However if I step into the next state and then examine the add_next state you can see that Array Add value variable has magically become None



Is this a problem anyone knows about? It makes Playmaker unusable for this system if it cannot be fixed and I'll have to rewrite it in code.  I am on Unity 2018.3 using Playmaker 1.9.0.p21.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Clearing Array causes other Actions to lose assigned variables
« Reply #1 on: October 15, 2020, 11:02:37 AM »
Hi.
I believe that you are only clearing the values, which means that the array still has the indexes but for example if its a string array it will set "" but not totally remove it from the array.

You can use 'Array Resize' to make the array empty.