Search Unity

dragtab is no longer working (Unity 2019). How can I make my Inspector look like this?

Discussion in 'Scripting' started by jerotas, May 14, 2019.

  1. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Here's my old custom inspector code, which displays nice before Unity 2019.

    Code (CSharp):
    1.         var text = "Music Ducking";
    2.         text = "<b><size=11>" + text + "</size></b>";
    3.  
    4.         if (state) {
    5.             text = "\u25BC " + text;
    6.         } else {
    7.             text = "\u25BA " + text;
    8.         }
    9.  
    10.         if (!GUILayout.Toggle(true, text, "dragtab", GUILayout.MinWidth(20f))) {
    11.             state = !state;
    12.         }
    13.  
    Looks like this when used in a couple consecutive sections:

    upload_2019-5-13_21-40-8.png

    But in Unity 2019 there is no inner background, no rounded corner, it's just the text on the gray background.

    I'm not sure how that code even works, I copied it from some other plugin years ago, but how can I make nice looking expandable areas like this that work in Unity 2019+?
     
    NagiX likes this.