Essential Systems / Attributes

Attributes

Enjoying Essential Systems?Leave a review

Learn to use the included attributes.

Optional

Makes a property toggleable in the inspector. When disabled, the value is ignored.

public class Test : MonoBehaviour
{
    public Optional<float> speed; // can be any type

    private void Start()
    {
        if (speed.Enabled)
        {
            Debug.Log(speed.Value);
        }
    }
}

ShowIf

Shows a property in the inspector only when a condition is met. Works with both enums and bools.

public class Test : MonoBehaviour
{
    public enum Setting { Foo, Bar }
    public Setting setting;

    [ShowIf("setting", Setting.Foo)]
    public float shownWhenFoo;

    public bool show;

    [ShowIf("show")]
    public float shownWhenTrue;
}
Last updated