You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Im really sorry to be filing an "issue", where there is none, perhaps it would be best to have a Unity Forums thread where i could place this instead..
Anyway, I'm really bad at writing Editor scripts, and what i need is to display List of MyStruct Items, where MyStruct is: [System.Serializable] public struct ContainerItemDefinition { public Texture2D texture; public string prefabName; }
Its in a separate Class that extends ScriptableObject, then this is instantiated into Assets/xyz folder, and EditorWindow uses EditorGUIUtility.Load to load that as it's data model. Then the EditorWindow calls this in its Awake function (to initialize the data model for rotorz): serializedObject = new SerializedObject(data); ciDefinitionsProperty = serializedObject.FindProperty("containerItemDefinitions");
Where containerItemDefinitions is [SerializeField] public List<ContainerItemDefinition> containerItemDefinitions;
So far so good. Tracing the data reveals, all was successful. Now to display the data, in OnGUI:
`if (this.serializedObject == null) {
return;
}
But i dont know the proper syntax or what objects to create here to properly list the struct items inside the list for rotorz. Specifically the DrawMyItem method (which i suppose should be used to draw one single item?) Im a bit lost when it comes to Editor GUI Labels/input fields/Object Picker/.. drawings of display elements. Can someone help me?
PS: I can simply use EditorGUILayout.PropertyField(ciDefinitionsProperty, true); //-> show children true!!!
which works okay for me, except it doesnt use Rotorz and so it doesnt support item reordering and the other fancy stuff ReorderableList gives you. I read somewhere, that the ",showChildren" is a new parameter, and before users had to write their own "PropertyDrawers" i guess is the name, ans thats what i need help with - how to draw those same GUI elements (string label and Texture2D picker) manually so rotorz can use them in the list display? Bit of code would be apprecciated, or guide that i could read to learn some Editor GUI scripting, thank you!
The text was updated successfully, but these errors were encountered:
Im really sorry to be filing an "issue", where there is none, perhaps it would be best to have a Unity Forums thread where i could place this instead..
Anyway, I'm really bad at writing Editor scripts, and what i need is to display List of MyStruct Items, where MyStruct is:
[System.Serializable] public struct ContainerItemDefinition { public Texture2D texture; public string prefabName; }
Its in a separate Class that extends ScriptableObject, then this is instantiated into Assets/xyz folder, and EditorWindow uses EditorGUIUtility.Load to load that as it's data model. Then the EditorWindow calls this in its Awake function (to initialize the data model for rotorz):
serializedObject = new SerializedObject(data); ciDefinitionsProperty = serializedObject.FindProperty("containerItemDefinitions");
Where containerItemDefinitions is
[SerializeField] public List<ContainerItemDefinition> containerItemDefinitions;
So far so good. Tracing the data reveals, all was successful. Now to display the data, in OnGUI:
`if (this.serializedObject == null) {
return;
}
But i dont know the proper syntax or what objects to create here to properly list the struct items inside the list for rotorz. Specifically the DrawMyItem method (which i suppose should be used to draw one single item?) Im a bit lost when it comes to Editor GUI Labels/input fields/Object Picker/.. drawings of display elements. Can someone help me?
PS: I can simply use
EditorGUILayout.PropertyField(ciDefinitionsProperty, true); //-> show children true!!!
which works okay for me, except it doesnt use Rotorz and so it doesnt support item reordering and the other fancy stuff ReorderableList gives you. I read somewhere, that the ",showChildren" is a new parameter, and before users had to write their own "PropertyDrawers" i guess is the name, ans thats what i need help with - how to draw those same GUI elements (string label and Texture2D picker) manually so rotorz can use them in the list display? Bit of code would be apprecciated, or guide that i could read to learn some Editor GUI scripting, thank you!
The text was updated successfully, but these errors were encountered: