Skip to content

Max Value

[MaxValue] The attribute checks that the number field is less than/equal to specific value.


Support Types

Type
Integer
Float
Double

Parameters

Parameter Name Description
Value Max possible value for number field.
PropertyName Max possible value represented in property for number field.
Tolerance TODO!

Examples

[MaxValue("maxHealth")]
public int health;

[MaxValue(100)]
public int maxHealth;

[MaxValue(10)]
public float runSpeed;

[MaxValue("runSpeed", 1)]
public float walkSpeed;

[MaxValue(10)]
public double someValue;

[MaxValue("someValue", 0.9f)]
public double someValue2;
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
{
    [MaxValue(100)]
    public int speed;
}

Live-demo

Live demo