Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

How to show GUILayout.Toggle with richText label?

Discussion in 'Immediate Mode GUI (IMGUI)' started by andersemil, Mar 12, 2021.

  1. andersemil

    andersemil

    Joined:
    Feb 2, 2015
    Posts:
    84
    I'm trying to show a toggle box with a text label containing richText markup. If I do this:

    Code (CSharp):
    1. toggled = GUILayout.Toggle (toggled, "<b>TOGGLE</b>");
    - the markup is not getting parsed. If I do this:

    Code (CSharp):
    1. var toggleStyle = new GUIStyle {
    2.             richText = true,
    3.         };
    4. toggled = GUILayout.Toggle (toggled, "<b>TOGGLE</b>", toggleStyle);
    - the markup gets parsed, but the toggle box disappears completely.
     
  2. andersemil

    andersemil

    Joined:
    Feb 2, 2015
    Posts:
    84
    In fact, any time I apply a style to a toggle, it disappears
     
unityunity