Range

Applies to: properties (numeric)

Namespace:

namespace Lenga\Engine\Attributes;

Constrains a serialized numeric property to a minimum/maximum range in the Inspector. The field is displayed as a slider instead of a plain number input, making it easy to tune values visually.

Parameters

Parameter Type Description
$minValue float\|int The minimum value of the slider.
$maxValue float\|int The maximum value of the slider.

Example

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

class AudioManager extends Behaviour
{
    #[Range(0.0, 1.0)]
    public float $masterVolume = 0.8;

    #[Range(0, 10)]
    public int $reverb = 3;

    public function update(): void
    {
        // apply masterVolume to audio output...
    }
}