playMaker

Author Topic: ArgumentException: Array was not a one-dimensional array [SOLVED]  (Read 3375 times)

Raika

  • Playmaker Newbie
  • *
  • Posts: 30
Everything works fine, but I have 2 object, which after clicking one of them I am constantly receiving error below:

Quote
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/FsmSearch.cs:257)
HutongGames.PlayMakerEditor.FsmSearch.FindEventsSentBy (System.Object obj, Int32 currentDepth) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/FsmSearch.cs:273)
HutongGames.PlayMakerEditor.FsmSearch.FindEventsSentBy (System.Object obj, Int32 currentDepth) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/FsmSearch.cs:273)
HutongGames.PlayMakerEditor.FsmSearch.FindEventsSentBy (System.Object obj, Int32 currentDepth) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/FsmSearch.cs:273)
HutongGames.PlayMakerEditor.FsmSearch.FindEventsSentBy (System.Object obj, Int32 currentDepth) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/FsmSearch.cs:273)
HutongGames.PlayMakerEditor.FsmSearch.DoSearch () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/FsmSearch.cs:178)
HutongGames.PlayMakerEditor.FsmSearch.Update () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/FsmSearch.cs:150)
HutongGames.PlayMakerEditor.FsmSearch.Update (HutongGames.PlayMaker.Fsm fsm) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/FsmSearch.cs:103)
HutongGames.PlayMakerEditor.FsmEditor.OnInspectorUpdate () (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/Classes/FsmEditor.cs:801)
HutongGames.PlayMakerEditor.FsmEditorWindow.OnInspectorUpdate () (at Assets/PlayMaker/Editor/FsmEditorWindow.cs:284)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:291)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:284)
UnityEditor.HostView.OnInspectorUpdate () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:174)

Also when i double click on this error instead of visual studio open i get this in inspector:


« Last Edit: August 10, 2018, 10:49:37 AM by Raika »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: ArgumentException: Array was not a one-dimensional array
« Reply #1 on: July 14, 2018, 12:58:53 PM »
Hi.
What unity/playmaker version are you using?

Can you show the objects/fsms/actions?

is this a new project or updated from older versions?

Raika

  • Playmaker Newbie
  • *
  • Posts: 30
Re: ArgumentException: Array was not a one-dimensional array
« Reply #2 on: July 14, 2018, 02:49:07 PM »
Now i'm using 2018.1.1f1/1.9.0 and i upgrade this project from 5.6.1f1/1.8.5.
Also when i pause scene, error still pop up and in the variables tab all variables have 0 used. If you want i can screenshot all the states or somehow export those objects.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ArgumentException: Array was not a one-dimensional array
« Reply #3 on: July 16, 2018, 03:10:42 AM »
Hi,

 ok, the first thing to make sure is the process of upgrading.

 first, you need to update PlayMaker, then you update Unity. Can you confirm that you did this? if you first open your project in a newer version of Unity, PlayMaker and other assets may break because they don't support that newer version.

Bye,

 Jean

Raika

  • Playmaker Newbie
  • *
  • Posts: 30
Re: ArgumentException: Array was not a one-dimensional array
« Reply #4 on: July 16, 2018, 06:16:28 AM »
Now i'm after format,i done stupid thing, i was thinking that just copy folder with project and then open with newest installed unity will work. Than i created new project, install 1.9.0 and import all needed assets and then i copy/paste folder with mine scenes/prefabs. Also i copy/paste folder with globals. Game work properly (except for the problem I described).

So how many stupid things i done?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ArgumentException: Array was not a one-dimensional array
« Reply #5 on: July 16, 2018, 03:26:08 PM »
Hi,

 As I said, you first need to update PlayMaker, and the update Unity, this will guarantee a smoother transition.

 Bye,

 Jean

Raika

  • Playmaker Newbie
  • *
  • Posts: 30
Re: ArgumentException: Array was not a one-dimensional array
« Reply #6 on: July 16, 2018, 04:28:54 PM »
Ok, i will try this.

Raika

  • Playmaker Newbie
  • *
  • Posts: 30
Re: ArgumentException: Array was not a one-dimensional array
« Reply #7 on: July 17, 2018, 05:56:02 AM »
So, only after updating playmaker to 1.9.0 i get same issue, but i will just use 1.8.5.
Fsm that have this problem need to work only on start and than i can remove them, can this be good solution or not?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ArgumentException: Array was not a one-dimensional array [Solved]
« Reply #8 on: July 18, 2018, 04:44:01 AM »
Hi,

 so you have this issue on Unity 5.6 and playmaker 1.9 ?

Bye,

 Jean

Raika

  • Playmaker Newbie
  • *
  • Posts: 30
Re: ArgumentException: Array was not a one-dimensional array [Solved]
« Reply #9 on: July 18, 2018, 06:39:14 AM »
yes, 5.6.1f1/1.8.5 to 5.6.1f1/1.9.0. Can it be any related to legacy networking?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ArgumentException: Array was not a one-dimensional array [Solved]
« Reply #10 on: July 19, 2018, 04:41:02 AM »
Hi,

 could you share the original project and the corrupted project, Pm me on this.

 We need to address this, it might be indeed because of something inside the fsm indeed.

 I'll raise this issue meanwhile so that we start looking for the issue.

 Bye,

 Jean

Raika

  • Playmaker Newbie
  • *
  • Posts: 30
Re: ArgumentException: Array was not a one-dimensional array
« Reply #11 on: August 06, 2018, 08:43:49 AM »
So i done few more testing, issue occurs when action: Get Property is activated.
Below is script on which one i'm using this action. Can it by problem with script?
I hadn't made this script.
Quote
using UnityEngine;
using System.Collections;

public class MapGenerator : MonoBehaviour
{

    public enum DrawMode { NoiseMap, ColourMap };
    public DrawMode drawMode;

    public int mapWidth;
    public int mapHeight;
    public float noiseScale;

    public int octaves;
    [Range(0, 1)]
    public float persistance;
    public float lacunarity;

    public int seed;
    public Vector2 offset;

    public bool autoUpdate;

    public TerrainType[] regions;
    //moje
    public int x;
    public int y;
    public float[,] MyNoiseMapFullXY;
    public float MyNoiseValueYes;

    public void GenerateMap()
    {
        float[,] noiseMap = Noise.GenerateNoiseMap(mapWidth, mapHeight, seed, noiseScale, octaves, persistance, lacunarity, offset);
        //test
        MyNoiseMapFullXY = noiseMap;
        //test
        Color[] colourMap = new Color[mapWidth * mapHeight];
        for (int y = 0; y < mapHeight; y++)
        {
            for (int x = 0; x < mapWidth; x++)
            {
                float currentHeight = noiseMap[x, y];
                for (int i = 0; i < regions.Length; i++)
                {
                    if (currentHeight <= regions.height)
                    {
                        colourMap[y * mapWidth + x] = regions.colour;
                        break;
                    }
                }
            }
        }

        MapDisplay display = FindObjectOfType<MapDisplay>();
        if (drawMode == DrawMode.NoiseMap)
        {
            display.DrawTexture(TextureGenerator.TextureFromHeightMap(noiseMap));
        }
        else if (drawMode == DrawMode.ColourMap)
        {
            display.DrawTexture(TextureGenerator.TextureFromColourMap(colourMap, mapWidth, mapHeight));
        }
    }

    void OnValidate()
    {
        if (mapWidth < 1)
        {
            mapWidth = 1;
        }
        if (mapHeight < 1)
        {
            mapHeight = 1;
        }
        if (lacunarity < 1)
        {
            lacunarity = 1;
        }
        if (octaves < 0)
        {
            octaves = 0;
        }
    }
    //test
    public void GiveMePerlinNoiseValue()
    {
        MyNoiseValueYes = MyNoiseMapFullXY[x, y];
    }
    //test
}

[System.Serializable]
public struct TerrainType
{
    public string name;
    public float height;
    public Color colour;
}

Raika

  • Playmaker Newbie
  • *
  • Posts: 30
Re: ArgumentException: Array was not a one-dimensional array
« Reply #12 on: August 10, 2018, 10:49:05 AM »
Finally i have solution, As I wrote in the previous post, the problem occurs when the Get Property or Call Method actions are used in one particular script (also with a small difference the problem occur in 1.8.5). So i created new script which i'm accessing via fsm and this script can access issueScript without problem. I don't know what created this issue, but this specific solution work for me.