Is it possible to create a List with UIElements, when the List is in the same class as MyEditor? I want to create/map/bind it in .uxml file, but dont know how (or is it even possible).
in example (blabla code):
public class MyEditor : EditorWindow
{
public List<string> someStringList = new List<string>();
// Rest of EditorWindow code...
}
The ability to declare a generic list in a class is independent from UIElements. Just add using System.Collections.Generic; at the top of your file, or use the full name of System.Collections.Generic.List<T>.
Yes, I know that I mean, how to make this list visible in my editor (not inspector) Window in Unity.
For example (in uxml file) : creates a Text field. How to create a list/array in that way?
== SOLVED ==
I figured it out! Simply I just need this: rootVisualElement.Q<PropertyField>("stringList").Bind(new SerializedObject(this)); and properly configured UXML: <ue:PropertyField name="stringList" label="Unaccepted climates: " binding-path="stringes"/>, where “stringes” is my List variable name located in MyEditor.
Hi. I’m trying to achieve the same thing. Unfortunately I cannot make this work on my project. I get hit with a NullReferenceException even though I’m using the exact same name in both scripts. Here are the full code: