playMaker

Author Topic: Two actions related to arrays are causing troubles  (Read 1724 times)

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Two actions related to arrays are causing troubles
« on: August 19, 2019, 01:00:07 PM »
I had two issues with two actions relevant to arrays.
Playmaker 1.8.8 and Unity 2017.4.3f1

Array List Add
I try to target two Array List proxies on another game object. One proxy is called toActivate, the other toDeactivate.
I also use "local" actions on the game object holding these two proxies; they work fine with the Array Lists. Only the actions in another game object fail to find the references.
I typed the proxies' names and also tried using string vars. Nothing worked.
I had slightly changed the names of the actions (two copies of the same one) in the state so I thought that could be the reason. I deleted them and put back vanilla versions.
The problem was still there. But where this gets crazy is that when running the application, I did get the error, so I deactivated those two actions and put, again, two new ones, into the same state.
Then it worked flawlessly.
I tried this twice, the bug and the solution are confirmed.
To sum up: add the actions whilst not running and then run the app, you'll get the bug. Add the actions during run mode and the bug won't happen.

Also, the Array List action can't find the proxies present on the game object when clicking on "..."
Note that Hashtable Add doesn't offer this "..." button.


Array Activate Game Objects
The first item is skipped.
The only way I could walk around this was to add an empty game object (not a null reference) that serves no other purpose than to occupy the first spot at index 0.
EDIT: this is actually weirder. The number of items in the array is somehow relevant, but not the way I thought.
The only way to make the action work is to have it run twice, BUT re-adding the same item between the two runs:
GO1's FSM: adds banana to array var on GO2
GO2's FSM: item is added, but action does not activate the object found in the array.
GO1's FSM: adds the same banana again.*
GO2's FSM: banana present twice. Action acknowledges both and activates them.

Note that I tried to add items with both FSM Array Add and FSM Array Add Range (to be quicker in adding items).
Why I say this is that if I add the banana twice, thrice or more in the first phase (either with multiple copies of FSM Array Add or using the FSM Range Add), it will not matter, the action on the GO2 will not activate the items.
Also, rerunning the action on the GO2 will not work either if items weren't added before the rerun.

* I just made a test in run mode and instead of adding the same object, I changed the field to point to two other objects from my scene (with no relation to each other), and it worked too. I mean, the bug is still there and it seems the action only cares that items are added a second time to acknowledge them. It's as if it were doing an 'array change' check and if finding something like "true", it would work.

EDIT2: Right, whether I add items from another FSM or in the FSM that holds the array vars, it doesn't change anything. What is clear is that I need to add items twice to the array for it to be noticed by the action that is supposed to parse the array and activate (or deactivate) its items.
Thus far I will therefore use a second Array Add action in the FSM that has the array vars, adding a dummy item that will just make sure the array is modified twice.
I'm quite happy I can actually circumvent that odd bug for the moment.

The action also exits if one single 'null' reference is found. This brutal exit should be left as an option as sometimes it's possible to have one or more slots remaining empty.
« Last Edit: August 19, 2019, 02:20:15 PM by Broken Stylus »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Two actions related to arrays are causing troubles
« Reply #1 on: August 21, 2019, 02:26:39 AM »
Hi,

 PlayMaker 1.8.8 is very old, I would strongly recommend upgrading to the latest, else you are going to end up in bigger trouble as version disparity increases over time.

Make a copy of you project, and in that copy, update PlayMaker, and let me know if you still get this issues, ok?

Bye,

 Jean


Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Re: Two actions related to arrays are causing troubles
« Reply #2 on: August 23, 2019, 10:13:54 AM »
Yes, I think I'll move on very soon. However I'll not go up to Unity 2018.4 now because last time I tried, I got sooo many errors and broken files that I just gave up. Solving one error would sometimes trigger two or three new ones. Since I'm weary of the time needed to correct all the issues raised by that big update, I'm postponing it. But upgrading PM, that I could do.

Also, unrelated, is there a way to deactivate the autocorrect function on this forum?
When my computer is a bit low on memory and cpu, it totally kills it. I had to shove two hard resets on the computer within three days and it unfortunately did leave issues.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Two actions related to arrays are causing troubles
« Reply #3 on: September 12, 2019, 02:16:51 AM »
Hi,

 what do you mean autocorrect? do you mean grammar correction? that's something to control inside your OS/webbrowser, html fields do not autocorrect by themselves, it's the browser/OS that provide this functionnality.


Bye,

 Jean

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Re: Two actions related to arrays are causing troubles
« Reply #4 on: September 12, 2019, 05:31:13 AM »
I discovered that option lately. I never used them on PC, I forgot they're a default option on Safari. The computer was having severe slowdowns on this forum in particular, for some reason. I suspected a spell checker module local to this place.
Never mind.