Class FloatRangeAttribute
Declares the valid numeric range of a float field, property or parameter, plus optional
display hints for Inspector tooling (render as a percentage slider, and/or show a reset button).
The range is a domain-meaningful value constraint; the display flags are pure authoring conveniences.
No Unity dependency, so it can be applied in the Domain layer.
Implements
Inherited Members
Namespace: Serenity.Global.Domain.Attributes
Assembly: Serenity.Global.Domain.dll
Syntax
[AttributeUsage(AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)]
public sealed class FloatRangeAttribute : Attribute, _Attribute
Constructors
FloatRangeAttribute(float, float, bool, bool, float)
Declares a value range with optional display hints.
Declaration
public FloatRangeAttribute(float min, float max, bool displayAsPercentage = false, bool resettable = false, float resetValue = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| float | min | Inclusive minimum. |
| float | max | Inclusive maximum. |
| bool | displayAsPercentage | Render as a 0–100% slider. |
| bool | resettable | Show a reset button. |
| float | resetValue | Value the reset button applies. |
Properties
DisplayAsPercentage
Declaration
public bool DisplayAsPercentage { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Max
Inclusive maximum value.
Declaration
public float Max { get; }
Property Value
| Type | Description |
|---|---|
| float |
Min
Inclusive minimum value.
Declaration
public float Min { get; }
Property Value
| Type | Description |
|---|---|
| float |
ResetValue
The value applied by the reset button (defaults to 0, e.g. centered stereo pan).
Declaration
public float ResetValue { get; }
Property Value
| Type | Description |
|---|---|
| float |
Resettable
When true, the editor shows a button that resets the value to ResetValue.
Declaration
public bool Resettable { get; }
Property Value
| Type | Description |
|---|---|
| bool |