- Home /
Two lists with related sizes
I have two public lists in my class.
From inspector I can change their sizes. I want their sizes depends on each other (when i change size of one second changes too), but I have no idea how to achieve it.
I tried to make my own class which inherits from list (that would let me call event on list rebuilding) and use it, but it dosn't display in inspector.
Co You have any ideas how to do this?
public class ListsTest : MonoBehaviour {
public List<string> list1 = new List<string>();
public List<string> list2 = new List<string>();
public class MyList<T>: List<T>{
}
public MyList<string> list3 = new MyList<string>();
}
Have you tried to make your class Serializable ? (Put [System.Serializable]
just before the declaration of your class)
Answer by · Oct 06, 2017 at 04:28 PM
You will probably need to make a Custom Inspector for your script https://unity3d.com/learn/tutorials/topics/interface-essentials/building-custom-inspector
Your answer

Follow this Question
Related Questions
Creating a custom inspector utilizing a list of class instances with serialization? 1 Answer
Methods list in inspector 0 Answers
What is the best way to handle a scenario game with a LOT of panels? 0 Answers
Unity Inspector limiting display of nested lists. 2 Answers
Unity editor - sort items in any list visible in inspector 2 Answers