Documentation

Page contents

Updated

Generate PDF from page.

Locking properties

Description

Allows enable or disable fields from inspector according to a float value.

Every property construction method has an overload with two additional parameters to add float value that enable or disable the field.

Reference

Use

In this example each method to build properties receives a “_LockingFloat” variable as a parameter that lock other property.

public class CGFSampleMaterialEditor : CGFMaterialEditorClass
{
    MaterialProperty _LockingFloat;
    MaterialProperty _Float;
    public override void OnEnable()
    {
        base.OnEnable();
        GetProperties();
    }
    private void GetProperties()
    {
         _LockingFloat = FindProperty("_LockingFloat");
         _Float = FindProperty("_Float");
    }
    public override void InspectorGUI()
    {
        CGFMaterialEditorUtilitiesClass.BuildFloat("Locking Float", "Locking Float.", _LockingFloat);
        CGFMaterialEditorUtilitiesClass.BuildFloat("Float", "Float", _Float, _LockingFloat.floatValue;
    }
}