Playmaker Forum

Bug Reporting => PlayMaker Bug Reporting => Topic started by: diccon on October 14, 2020, 01:47:09 PM

Title: Clearing Array causes other Actions to lose assigned variables
Post by: diccon 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

(https://i.ibb.co/J2z4Kdz/playmakerbug1.png) (https://ibb.co/Y8tM3Wt)

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

(https://i.ibb.co/HGvVhPw/playmakerbug2.png) (https://ibb.co/c251Y8f)

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

(https://i.ibb.co/281djBc/playmakerbug3.png) (https://ibb.co/RhkcCWQ)

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.
Title: Re: Clearing Array causes other Actions to lose assigned variables
Post by: djaydino 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.