VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Public Types | Public Member Functions | Properties | List of all members
AVR.Core.Attributes.ConditionalHideInInspector Class Reference

Allows for simple hiding of properties in the UnityEditor depending on certain conditions. For instance, in the following example the "type" field will only be displayed in the inspector if the "tracking" field is set to true: More...

Inheritance diagram for AVR.Core.Attributes.ConditionalHideInInspector:

Public Types

enum  compareType {
  compareType.EQUAL, compareType.BIGGER, compareType.SMALLER, compareType.BIGGEREQUAL,
  compareType.SMALLEREQUAL, compareType.UNEQUAL
}
 

Public Member Functions

 ConditionalHideInInspector (string hideConditionPropertyName, bool invertCondition=false)
 Hides a field in the Inspector if a given condition is true.

Parameters
hideConditionPropertyNameThe first parameter is always the name of the field that represents the condition. The name is case-sensitive.
invertConditionWill invert the given condition. Hence why in the example above, tracking = false hides the type field.
More...
 
 ConditionalHideInInspector (string hideConditionPropertyName, float compareValue, compareType ctype=compareType.EQUAL, bool invertCondition=false)
 Hides a field in the Inspector if a given condition is true.

Parameters
hideConditionPropertyNameThe first parameter is always the name of the field that represents the condition. The name is case-sensitive.
invertConditionWill invert the given condition. Hence why in the example above, tracking = false hides the type field.
compareValueOptionally, one can compare the given field with some given value. The type of comparison is determined by:
ctypeType of comparison performed if a compareValue is provided. Examples:
More...
 
 ConditionalHideInInspector (string hideConditionPropertyName, int compareValue, compareType ctype=compareType.EQUAL, bool invertCondition=false)
 Hides a field in the Inspector if a given condition is true.

Parameters
hideConditionPropertyNameThe first parameter is always the name of the field that represents the condition. The name is case-sensitive.
invertConditionWill invert the given condition. Hence why in the example above, tracking = false hides the type field.
compareValueOptionally, one can compare the given field with some given value. The type of comparison is determined by:
ctypeType of comparison performed if a compareValue is provided. Examples:
More...
 

Properties

compareType ctype [get, set]
 
string hideConditionPropertyName [get, set]
 
bool invertCondition [get, set]
 
float compareValue [get, set]
 

Detailed Description

Allows for simple hiding of properties in the UnityEditor depending on certain conditions. For instance, in the following example the "type" field will only be displayed in the inspector if the "tracking" field is set to true:

public bool tracking = false;
public TrackingType type;
// Hides the variable if "counter" is larger than 3
[AVR.Core.Attributes.ConditionalHideInInspector("counter", 3, AVR.Core.Attributes.ConditionalHideInInspector.compareType.BIGGER)]
// Hides the variable if "type" is equal to TypeEnum.TYPE2. Since "EQUAL" is the default comparison mode, the parameter is optional.
[AVR.Core.Attributes.ConditionalHideInInspector("type", (int)TypeEnum.TYPE2)]
Parameters
hideConditionPropertyNameThe first parameter is always the name of the field that represents the condition. The name is case-sensitive.
invertConditionWill invert the given condition. Hence why in the example above, tracking = false hides the type field.
compareValueOptionally, one can compare the given field with some given value. The type of comparison is determined by:
ctypeType of comparison performed if a compareValue is provided. Examples:

Definition at line 128 of file AVR_Attributes.cs.