Search Unity

Question Expand GUI

Discussion in 'Immediate Mode GUI (IMGUI)' started by avicenteUnity1234, Feb 8, 2024.

  1. avicenteUnity1234

    avicenteUnity1234

    Joined:
    Jun 2, 2023
    Posts:
    12
    Hello, I have this code to put two TextField, when clicking on the Toogle:

    Code (CSharp):
    1.  public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    2.     {
    3.         EditorGUI.BeginProperty(position, label, property);
    4.  
    5.         Rect rectFoldout = new Rect(position.min.x, position.min.y, position.size.x,
    6.                                         EditorGUIUtility.singleLineHeight);
    7.  
    8.         checkBoxValue = EditorGUI.Toggle(position, label, checkBoxValue);
    9.         int lines = 1;
    10.         if (checkBoxValue)
    11.         {
    12.             Rect rectField1 = new Rect(position.min.x, position.min.y + lines++ * EditorGUIUtility.singleLineHeight, position.size.x, EditorGUIUtility.singleLineHeight);        
    13.             EditorGUI.TextField(rectField1,"Paso 1", objNames);
    14.             Rect rectField2 = new Rect(position.min.x, position.min.y + lines++ * EditorGUIUtility.singleLineHeight, position.size.x, EditorGUIUtility.singleLineHeight);
    15.             EditorGUI.TextField(rectField2, "Paso 2", objNames);
    16.         }
    17.         EditorGUI.EndProperty();
    18.     }
    My question is, how could I lower the position of what I have below in the editor?

    upload_2024-2-8_8-46-15.png

    Thanks.