Search Unity

Collapsable Header

Discussion in 'Editor & General Support' started by phoda, Jun 16, 2018.

  1. phoda

    phoda

    Joined:
    Nov 11, 2014
    Posts:
    384
    In editor you can add [Header("Header")] above some variable and gives it distinct spacing and header.

    Is there a way to make it like that but that it collapses a section. I have PLENTY of variables and dont want to split them to multiple scripts so can i mark 10-20 variables and group them under one collapsable menu in inspector (they are variables i have to drag and drop items to) or is there better way to organize a lot of variables?
     
  2. phoda

    phoda

    Joined:
    Nov 11, 2014
    Posts:
    384
    bump
     
  3. HeavyMetalSnail

    HeavyMetalSnail

    Joined:
    Jun 12, 2018
    Posts:
    13
    You need to take a look at customEditors for that, more specifically, the EditorGUILayout.Foldout

    There is an example of it in the last episode of this series :
     
    phoda likes this.