playMaker

Author Topic: ArgumentException: Array was not a one-dimensional array.  (Read 1503 times)

JohnJones

  • Playmaker Newbie
  • *
  • Posts: 2
ArgumentException: Array was not a one-dimensional array.
« on: November 27, 2018, 04:00:43 PM »
in my FSM I get an int from an array in another FSM and all works just fine.

However whenever the script passes over the "Get FSM Array Item" action again the action gives me an old (I suppose cached) value in stead of a fresh value from the now updated array in the other FSM.

Why? And how do I fix this?

« Last Edit: December 09, 2018, 08:22:21 AM by JohnJones »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Get FSM Array Item only works once
« Reply #1 on: December 03, 2018, 01:32:11 AM »
Hi,

 maybe you do that too soon? have you try using the SaveChange action on the ecosystem, this might help.

 Bye,

 Jean

JohnJones

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Get FSM Array Item only works once
« Reply #2 on: December 09, 2018, 08:16:08 AM »
Perhaps you are right, but there is no way to know
In the mean time I have tried to work around this issue, by rewriting the entire thing.

But I am getting another error now:
ArgumentException: Array was not a one-dimensional array

A similar error was discussed here:
https://hutonggames.com/playmakerforum/index.php?topic=19094.0
It is unclear to me how this person solved the issue though

I see you are the same person who reacted to that topic,
perhaps you could help me out.


Currently there is an AI script written in cs.
I send 2 arrays to the script using set-property (both are one dimensional arrays).
I call a method that runs the AI script
_____The script does its thing_______
The script then fires up an event in my FSM
The FSM uses get property to get 2 public int variables from the script
Done


Somewhere in this process unity starts burping up hundreds upon hundreds of error messages saying

ArgumentException: Array was not a one-dimensional array.
System.Array.GetValue (Int32 index) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Array.cs:485)
HutongGames.PlayMakerEditor.FsmSearch.FindEventsSentBy (System.Object obj, Int32 currentDepth) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/FsmVariablesEditor.cs:835)


The error messages continue for a while after having stopped the game.

FYI:
I am only using one dimensional arrays
I am using Playmaker 1.9.0 in Unity 2018.2.13f1


Thanks for your time.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ArgumentException: Array was not a one-dimensional array.
« Reply #3 on: December 12, 2018, 03:44:21 AM »
Hi,

you need to go over the set property and run method actions to make sure you have set them up properly, this is likely because you the actions do not match the method or property exactly.

Bye,

 Jean