I'm working on a custom action that requires a collection of a custom serializable class type, but the functionality doesn't seem to work in the way that I'm expecting.
Here's an example of what I'm trying to do:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HutongGames.PlayMaker;
public class TestArraysAction : FsmStateAction {
[System.Serializable]
public class NamedObject
{
public GameObject go;
public string name;
public string id;
}
public NamedObject[] namedObjectsArray;
[ArrayEditor(typeof(NamedObject))]
public FsmArray namedObjectsFsmArray;
public override void OnEnter()
{
foreach (NamedObject t in namedObjectsArray)
{
Debug.LogFormat("Object {0} has an ID of {1}", t.name, t.id);
}
foreach (NamedObject t in namedObjectsFsmArray.Values)
{
Debug.LogFormat("Object {0} has an ID of {1}", t.name, t.id);
}
Finish();
}
}
In the action's inspector in playmaker I can change the array size (similar to how I could in a typical unity inspector), but none of the serializable class's fields show up in the inspector. I also tried using the FsmArray, but when I go to change the number of items in the collection, it immediately resets to 0.
Is there a different method for including collections of serializable classes in custom actions?