Search Unity

Show bool as button at right place

Discussion in 'Immediate Mode GUI (IMGUI)' started by Librain, Mar 31, 2019.

  1. Librain

    Librain

    Joined:
    Sep 10, 2018
    Posts:
    7
    Hello community!
    I want to display my bool variable in inspector as button, but in right place.
    I have reached some kind of solution below, but it's draw my button at the bottom of the inspector...

    Code (CSharp):
    1.  
    2.  
    3.     public override void OnInspectorGUI()
    4.     {
    5.  
    6.         SpawnManager spawnManager = target as SpawnManager;
    7.         base.OnInspectorGUI();
    8.         if (GUILayout.Button("RefreshModifiersSpawn"))
    9.             spawnManager.RefreshModifiersSpawn = !spawnManager.RefreshModifiersSpawn;
    10.      }
    11.  
    P.S. at the picture, red rectangle - desired place for my button.
     

    Attached Files: