Min

Applies to: properties (numeric)

Namespace:

namespace Lenga\Engine\Attributes;

Clamps a serialized numeric property to a minimum value in the Inspector. The editor prevents the value from being set below the specified minimum. Use Range when you need both a minimum and maximum.

Parameters

Parameter Type Description
$minValue float\|int The minimum value the field can hold.

Example

use Lenga\Engine\Attributes\Min;
use Lenga\Engine\Core\Behaviour;

class Enemy extends Behaviour
{
    // Health can never be set below 1 in the Inspector
    #[Min(1)]
    public int $maxHealth = 100;

    // Speed cannot go negative
    #[Min(0.0)]
    public float $movementSpeed = 3.5;
}