Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

How do I make a header using Unity Editor?

Discussion in 'Scripting' started by Wellskd, Jun 7, 2020.

  1. Wellskd

    Wellskd

    Joined:
    May 20, 2020
    Posts:
    7
    I have searched for information but I'm not getting an answer - how do I make a header for my custom inspector using Unity Editor?

    In MonoBehavior I can use [Header("Text")], but this doesn't seem to work in Editor. I just want a bold and more prominent header for sections in my inspector than the simple label field.

    Does anyone know how to do this?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    32,400
    I'm thinking you can use rich text strings pretty much anywhere in the inspector window but I haven't tried it.
     
  3. NiallT

    NiallT

    Joined:
    Sep 22, 2018
    Posts:
    51
    Is that maybe a job for GUILayout.Label("text here")....?
     
  4. Wellskd

    Wellskd

    Joined:
    May 20, 2020
    Posts:
    7
    Got it.

    You have to use EditorStyles.* to get the bold style when using Editor.

    Example
    EditorGUILayout.LabelField("Movement Settings", EditorStyles.boldLabel);


    Thank you both!