Nested class Lists inspector overlapping bug
I wrote a code similar to this:
using System.Collections.Generic;
using UnityEngine;
using System;
[Serializable]
public class class1 {
[Serializable]
public class class2 {
public int intParamter;
public string stringParameter;
}
public List<class1> class1s;
public List<class2> class2s;
}
public class test : MonoBehaviour {
public List<class1> class1s = new List<class1>();
}
But the inspector is overlapping.
Is there something wrong with the code or is this just a bug? Note: using Unity 2021.2.0a10.1508 with HDRP if that matters.
That didn't use to happen before it just suddenly occurred without any changes to the original script.
EDIT: sorry small typo in the code.
using System.Collections.Generic;
using UnityEngine;
using System;
[Serializable]
public class class1 {
[Serializable]
public class class2 {
public int intParamter;
public string stringParameter;
}
public List<class2> class2sA;
public List<class2> class2sB;
}
public class test : MonoBehaviour {
public List<class1> class1s = new List<class1>();
}
Still the same problem. I just wanted to correct it before someone says that every element of "class1" has a list of "class1" which contains an element of "class1"... and so on, so the problem is caused by exceeding the serialization depth limit. which is not the case. I think.
Answer by Voltonik_ · Apr 10, 2021 at 03:14 PM
So apparently this is a known bug and will be fixed. hopefully soon. https://issuetracker.unity3d.com/issues/scriptableobject-with-an-array-of-serializable-classes-with-arrays-in-them-is-overlapping-in-the-inspector-when-expanded
EDIT: As a temporary fix till its fixed I used the [NonReorderable] Attribute to disable the reorderable list rendering
Your answer
Follow this Question
Related Questions
Inspector overlapping component problem 2 Answers
Destroy gameobjects several times in a scene. Also destroy other instances of that gameobject. 2 Answers
Values not updating in Unity. - UPDATED 1 Answer
a list with a constructor class that also contains a list. 1 Answer
Generic component reference 0 Answers