UnityEvent在类中作为属性进行序列化时丢失其自定义检查器

时间:2018-03-12 13:19:48

标签: c# unity3d unity-editor

所以我有一个Serializable类数组,每个类都有自己的Serializable类数组,每个类都有一个UnityEvent。

class a : ScriptableObject
{
    entry[] entries
}

[Serializable]
class entry
{
    option[] Options
}

[Serializable]
class option
{
    string name;
    UnityEvent action;
}

the inspector of action

与普通检查员视图相反

example of normal inspector

1 个答案:

答案 0 :(得分:1)

您无法序列化UnityEvent。您需要为此创建一个自定义类,如下所示: https://answers.unity.com/questions/1275147/can-you-force-unity-to-serialize-a-unityevent-in-t.html