Search Unity

Question Using GUI.Toggle in editor window script how to change the check box position to be on the right?

Discussion in 'Immediate Mode GUI (IMGUI)' started by eshelshlomi1999, May 20, 2023.

  1. eshelshlomi1999

    eshelshlomi1999

    Joined:
    Apr 1, 2023
    Posts:
    17
    in the screenshot on the left how it is now and on the right is what I mean to put the toggle box the check box on the right side of the string.



    the reason I'm using GUI.Toggle instead GUILayout.Toggle is beacuse I can control on much properties on the toggle that way and that the content text is much closer to the toggle check box.

    now I want to move the check box to be on the right of the string text.

    Code (csharp):
    1.  
    2. void OnGUI()
    3.     {
    4.         GUILayout.Space(35);
    5.         includeInactive = GUI.Toggle(new Rect(10, 40, 130, 10),includeInactive, " Include Inactive");
    6.     }
    7.