Wanzyee Studio
EnumConstraintAttribute

UnityEngine.PropertyAttribute to select the enum from specified values. More...

Inherits PropertyAttribute.

Public Member Functions

 EnumConstraintAttribute (params object[] constraints)
 Setup constraint enum values. More...
 
 EnumConstraintAttribute (int min, int max)
 Setup a range of the enum int values. More...
 

Public Attributes

readonly object[] constraints
 The constraint enum values. More...
 
readonly int min
 The min int value of the enum in range. More...
 
readonly int max
 The max int value of the enum in range. More...
 

Detailed Description

UnityEngine.PropertyAttribute to select the enum from specified values.

Declaring examples below:

[EnumConstraint(KeyCode.W, KeyCode.S, KeyCode.A, KeyCode.D)]
public KeyCode key;
[EnumConstraint((int)DayOfWeek.Mon, (int)DayOfWeek.Fri)]
public DayOfWeek day;

Constructor & Destructor Documentation

EnumConstraintAttribute ( params object[]  constraints)

Setup constraint enum values.

Parameters
constraintsConstraint values.
Returns
The instance.
EnumConstraintAttribute ( int  min,
int  max 
)

Setup a range of the enum int values.

Parameters
minMin value.
maxMax value.
Returns
The instance.

Member Data Documentation

readonly object [] constraints

The constraint enum values.

readonly int min

The min int value of the enum in range.

readonly int max

The max int value of the enum in range.