giuliano-marinelli / UnityFoldoutDecorator

Foldout as a Decorator for group variables in Unity Script Inspector

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UnityFoldoutDecorator

Foldout as a Decorator for group variables in Unity Script Inspector with options for:

  • change foldout name.
  • apply foldout to one or to many variables
  • set variables as read only
  • use styled or default editor versions

Preview

How to

Install

Download and copy the Editor and Inspector folders into your Project Assets.

Use

Just put the decorator above the variable and set the options you want:

[Foldout("Name", foldEverything = true, styled = true, readOnly = true)]

Example (same as image above):

public class MyScript : MonoBehaviour
{
    [Foldout("One styled with read only", foldEverything = false, styled = true, readOnly = true)]
    public float speed = 1f;
    public float retractSpeed = 1f;
    
    [Foldout("Styled ones", styled = true)]
    public float climbSpeed = 1f;
    public float nodeDistance = 2f;
    public float minDistance = 2f;
    
    [Foldout("Only this", false)]
    public int maxAmountNodes = 20;
    public GameObject nodePrefab;
    
    [Foldout("This and this", false)]
    public LayerMask hookableLayer;
    [Foldout("This and this", false)]
    public LayerMask collibleLayer;

    [Foldout("A group")]
    public Vector2 direction;
    public GameObject player;
    public GameObject spawn;

    [Foldout("Read only things", readOnly = true)]
    public bool done = false;
    public bool connected = false;
    public bool retracting = false;
    public bool climbing = false;
}

About

Foldout as a Decorator for group variables in Unity Script Inspector

License:MIT License


Languages

Language:C# 100.0%