Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity custom editor hide values in dropdown list

[CustomEditor(typeof(MyScript))]
 public class MyScriptEditor : Editor
 {
    private bool showFields;

    public override void OnInspectorGUI()
    {
    	// The Foldout stores a bool describing whether the foldout is expanded or not
        showFields = EditorGUILayout.Foldout(showFields, "Display Fields");

		// If the foldout is expanded, display all the values
        if (showFields)
        {
            EditorGUI.indentLevel++;
            
            // Use this to display everthing, or write code for a more customized editor here
            DrawDefaultInspector();
            
            EditorGUI.indentLevel--;
        }
    }
 }
 
PREVIOUS NEXT
Tagged: #unity #custom #editor #hide #values #dropdown #list
ADD COMMENT
Topic
Name
5+3 =