Validators
Property validator attributes check properties for the valid of the specified conditions.
Info
Each property can have multiple property validators.
Demo
Let’s create float value.
using UnityEngine;
public class ExampleComponent : MonoBehaviour
{
public float value;
}
Before use validators
Let’s add [MinValue(0)]
and [MaxValue(10)]
attributes to clamp value range in 0-10.
Note
Make sure that you have added ApexInspector namespace in your script, to get access to all attributes.
using ApexInspector;
using ApexInspector;
using UnityEngine;
public class ExampleComponent : MonoBehaviour
{
[MinValue(0)] [MaxValue(10)]
public float value;
}
Array after using Apex [MinValue] and [MaxValue] attributes