Skip to content

Visible If

[VisibleIf] attribute allow show/hide property by specific condition.


Support Types

Any types.


Parameters

Name Description
Property Name Boolean property name.
Name Description
Property Name Boolean property name.
Condition Set true to make this property active, while Property Name is true.
Set false to make this property active, while Property Name is false.
Name Description
First Property Numeric property name.
Condition Set specific condition:
> < <= >=
Second Property Numeric property name.

Examples

    /* --- Option 1 --- */
    public bool toggle;

    [VisibleIf("toggle")]
    public int intValue;
    /* ---------------- */


    /* --- Option 2 --- */
    public bool toggle2;

    [VisibleIf("toggle2", true)]
    public float someValue;
    /* ---------------- */


    /* --- Option 3 --- */
    public float value1;
    public float value2;

    [VisibleIf("value1", ">", "value2")]
    public string someText;
    /* ---------------- */
Note

Make sure that you have added ApexInspector namespace in your script, to get access to all attributes.

using ApexInspector;


Demo

using ApexInspector;
using UnityEngine;

public class ExampleComponent : MonoBehaviour
{
    public bool toggle;

    [VisibleIf("toggle")]
    public float value;
}

Live-demo

Live demo