Hi, I am trying to have a serialized class and I get this error as soon as I modify a value: "Unsupported type Generic Mono" PropertyModification.cpp at line: 130 There are literally no google result for "Unsupported type Generic Mono". So I thought I would post here. There is my script: Code (csharp): using UnityEngine; using System.Collections; using System.Collections.Generic; public class GoodsDropper : MonoBehaviour { [System.Serializable] public class DropItemDef { public GameObject Item = null; public int ItemValue = 0; } public Transform DropLocation; public List<DropItemDef> Items; public void DropRandomGoods() { } } I tried putting the serialize class outside of that class, or in its own file. I always get the same error. Here I am using public List<DropItemDef> Items; But I also tried with simple array: public DropItemDef[] Items; Always same error. But If I don't use an array, just single object like this: public DropItemDef Item; It works fine. Does anybody have any idea what I am doing wrong here? Thanks!
I dont think you can serialize GameObjects, so you wont be able to serialize DropItemDef. I had this problem in the past, i think it was the Transform object that caused the problem.
Where in the code do you modify the valus that cause the error? Are you creating the list? By default it will be null. public List<DropItemDef> Items = new List<DropItemDef>();
I modify the values in the inspector. I can change its size to 1, and then fill the data. It's the first time I try with a custom data type, and I get that error.
I actually having the same problem, and noticed that the problem is actually the list and the serializable class, they don't fit together, do know why and do know the solution. EDITED Ok, still not achieved a solution, but what I've made that "solved" the problem, was creating a class with the actual list, in this case would be a class [System.Serializable] public class DropItems { public List<DropItemDef> list; } And then I've used it as a normal item, like: Public DropItems Items; and the items would be called Items.list, which is kind of painful, but skipped the error.
I am also getting the same error. Weirdly, everything seems to be working and the error appears only when I try to edit one of the values through the inspector. I will try Unity Answers EDIT: If anyone with the same problem reaches this thread, the answer may be in this Unity Answer
Strange, I've done that plenty of times and never had an error, though I usually have the custom class sitting above and outside the main class definition like so: Code (csharp): using UnityEngine; using System.Collections; using System.Collections.Generic; [System.Serializable] public class DropItemDef { public GameObject Item = null; public int ItemValue = 0; } public class GoodsDropper : MonoBehaviour { public Transform DropLocation; public List<DropItemDef> Items; public void DropRandomGoods() { } } Also, if you're changing/re-factoring types/data that's already serialized in the game scene it's often best to reset the script component to defaults (click the little gear icon in the inspector).
Guys, thanks but you are resurrecting an old thread that is already solved in the Unity Answer post linked above.