Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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:
    111
    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:
    111
    In fact, any time I apply a style to a toggle, it disappears