Skip to content

Get Sansar

Script API

RangeAttribute

Where: Client
More page actions

For the complete documentation index, see llms.txt. This page is also available as Markdown.

Class Namespace Sansar.Script Inherits Attribute

Specify a range of valid values for the field in script properties.

[System.AttributeUsage(System.AttributeTargets.Field)]
public class RangeAttribute : Attribute

Remarks

Fields with a specified range will show in script properties with both a slider and an editable field. Values will be clamped to be within the range.

Members at a glance

KindMembers
ConstructorsRangeAttribute
PropertiesMax · Min

Constructors

RangeAttribute

public RangeAttribute()

Specify the allowed range of values for a field using named arguments.

Example
[Range(Min=-10.0, Max=10.0)]
public float namedRangeFloat;
public RangeAttribute(double min, double max)

Specify the allowed range of values for a float or double field.

ParameterTypeDescription
mindoubleThe lower bound on the range. Default: 0.0f
maxdoubleThe upper bound on the range. Default: 0.0f
Example
[Range(-10.0, 10.0)]
public float namedRangeFloat;
public RangeAttribute(int min, int max)

Specify the allowed range of values for an int field.

ParameterTypeDescription
minintThe lower bound on the range. Default: 0
maxintThe upper bound on the range. Default: 0
Example
[Range(-10, 10)]
public int rangeInt;

Properties

Max

public object Max { get; set; }

Used with default constructor to specify the upper bound on the range.

Value: object — The maximum allowed value for the parameter.

Example
[Range(Min=-10.0, Max=10.0)]
public float rangeFloat;

Min

public object Min { get; set; }

Used with default constructor to specify the lower bound on the range.

Value: object — The minimum allowed value for the parameter.

Example
[Range(Min=-10.0, Max=10.0)]
public float rangeFloat;

Generated from the Sansar 47.10.0 client ScriptApi snapshot.