Wanzyee Studio

UnityEngine.PropertyAttribute to filter the assigned object type by constraints. More...

Inherits PropertyAttribute.

Public Member Functions

 TypeConstraintAttribute ()
 Activate the UnityEngine.Component selecting menu. More...
 
 TypeConstraintAttribute (params Type[] constraints)
 Setup constraint types to filter, or only activate the selecting menu if nothing assigned. More...
 

Public Attributes

readonly Type[] constraints
 The constraint types to filter assigned object. More...
 

Detailed Description

UnityEngine.PropertyAttribute to filter the assigned object type by constraints.

Draw a common object field, but filter the assigned object type by constraint types. Generally for interface, a valid object has to derive from or implement all constraints. If there're multiple valid UnityEngine.Component attached to the same UnityEngine.GameObject. Also able to select one of them by right clicking on the object field.

Declaring examples below:

[TypeConstraint]
public MonoBehaviour someScript;
[TypeConstraint(typeof(IInterface))]
public Object someInterface;

Constructor & Destructor Documentation

Activate the UnityEngine.Component selecting menu.

Returns
The instance.
TypeConstraintAttribute ( params Type[]  constraints)

Setup constraint types to filter, or only activate the selecting menu if nothing assigned.

Parameters
constraintsConstraints.
Returns
The instance.

Member Data Documentation

readonly Type [] constraints

The constraint types to filter assigned object.