API reference
API reference
Select your platform
No SDKs available
No versions available

AssertUtils Class

Static Fields

HiglightColor : const string
Signature
const string Oculus.Interaction.AssertUtils.HiglightColor

Static Methods

AssertAspect< TValue > ( component , aspect , aspectLocation , whyItFailed , whereFailed , howToFix )
Asserts that an Aspect exists.
In case of failure, it will print an error showing why it failed, where it failed and suggest how to fix it.
Signature
static void Oculus.Interaction.AssertUtils.AssertAspect< TValue >(this Component component, TValue aspect, string aspectLocation, string whyItFailed=null, string whereFailed=null, string howToFix=null)
Parameters
component: this Component  The component requiring this Aspect
aspect: TValue  The Aspect to be checked
aspectLocation: string  The expected location of the Aspect
whyItFailed: string  Optional parameter specifying the reason the assert failed. If none is provided it will print the expected aspect type and location.
whereFailed: string  Optional parameter specifying where the failure can be found. If none is provided it will print the component address (GameObject->Component).
howToFix: string  Optional parameter suggesting how to fix the problem. If none is provided it will suggest assigning an Aspect of the required type to the expected location.
Returns
void
AssertCollectionField< TValue > ( component , value , variableName , whyItFailed , whereFailed , howToFix )
Asserts that a Serialized collection in a Component is not null, is not empty and all of its items exist.
In case of failure, it will print an error showing why it failed, where it failed and suggest how to fix it.
Signature
static void Oculus.Interaction.AssertUtils.AssertCollectionField< TValue >(this Component component, IEnumerable< TValue > value, string variableName, string whyItFailed=null, string whereFailed=null, string howToFix=null)
Parameters
component: this Component  The component to which this collection belongs.
value: IEnumerable< TValue >  The value of the collection.
variableName: string  The printed name of the serialized collection.
whyItFailed: string  Optional parameter specifying the reason the assert failed. If none is provided it will indicate that the collection value needs at least one valid item.
whereFailed: string  Optional parameter specifying where the failure can be found. If none is provided it will print the component address (GameObject->Component->Collection Name).
howToFix: string  Optional parameter suggesting how to fix the problem. If none is provided it will suggest assigning at least one valid item of the required type to the collection.
Returns
void
AssertCollectionItems< TValue > ( component , value , variableName , whyItFailed , whereItFailed , howToFix )
Asserts that each item in a Serialized collection in a Component is not null.
Note that the collection it might contain 0 items. In case of failure, it will print an error showing why it failed, where it failed and suggest how to fix it.
Signature
static void Oculus.Interaction.AssertUtils.AssertCollectionItems< TValue >(this Component component, IEnumerable< TValue > value, string variableName, string whyItFailed=null, string whereItFailed=null, string howToFix=null)
Parameters
component: this Component  The component to which the collection belongs.
value: IEnumerable< TValue >  The value of the collection.
variableName: string  The printed name of the serialized collection.
whyItFailed: string  Optional parameter specifying the reason the assert failed. If none is provided it will indicate, for each failed item, that the item must not be null.
whereItFailed: string  Optional parameter specifying where the failure can be found. If none is provided it will print the component address (GameObject->Component->Collection Name).
howToFix: string  Optional parameter suggesting how to fix the problem. If none is provided it will suggest assigning a valid item of the required type to the collection at each missing index.
Returns
void
AssertField< TValue > ( component , value , variableName , whyItFailed , whereItFailed , howToFix )
Asserts that a Serialized Field in a Component is not null.
In case of failure, it will print an error showing why it failed, where it failed and suggest how to fix it.
Signature
static void Oculus.Interaction.AssertUtils.AssertField< TValue >(this Component component, TValue value, string variableName, string whyItFailed=null, string whereItFailed=null, string howToFix=null)
Parameters
component: this Component  The component to which this field belongs.
value: TValue  The value of the field.
variableName: string  The printed name of the serialized field.
whyItFailed: string  Optional parameter specifying the reason the assert failed. If none is provided it will indicate that the field value was null.
whereItFailed: string  Optional parameter specifying where the failure can be found. If none is provided it will print the component address (GameObject->Component->Field Name).
howToFix: string  Optional parameter suggesting how to fix the problem. If none is provided it will suggest assigning a value of the required type to the field.
Returns
void
AssertIsTrue ( component , value , whyItFailed , whereItFailed , howToFix )
Asserts that the expression is True.
In case of failure, it will print an error showing where the failure happened.
Signature
static void Oculus.Interaction.AssertUtils.AssertIsTrue(this Component component, bool value, string whyItFailed=null, string whereItFailed=null, string howToFix=null)
Parameters
component: this Component  The component to which the value expression belongs
value: bool  The expression that should be true
whyItFailed: string  Optional parameter specifying the reason the assert failed
whereItFailed: string  Optional parameter specifying where the failure can be found. If none is provided it will print the component address (GameObject->Component).
howToFix: string  Optional parameter suggesting how to fix the problem.
Returns
void
Nicify ( variableName )
Make a displayable name for a variable.
This function will insert spaces before capital letters and remove optional m_, _ or k followed by uppercase letter in front of the name.
Signature
static string Oculus.Interaction.AssertUtils.Nicify(string variableName)
Parameters
variableName: string  The variable name as used in code
Returns
string  The nicified variable
WarnInspectorCollectionItems ( component , value , variableName , whyItFailed , whereItFailed , howToFix )
Shows a Warning for each item in a Serialized collection in a Component that is null.
It works just for UnityEngine.Object collections, Note that the collection it might contain 0 items. In case of failure, it will print a warning showing why it failed, where it failed and suggest how to fix it.
Signature
static void Oculus.Interaction.AssertUtils.WarnInspectorCollectionItems(this Component component, IEnumerable< UnityEngine.Object > value, string variableName, string whyItFailed=null, string whereItFailed=null, string howToFix=null)
Parameters
component: this Component  The component to which the collection belongs.
value: IEnumerable< UnityEngine.Object >  The value of the collection.
variableName: string  The printed name of the serialized collection.
whyItFailed: string  Optional parameter specifying the reason the assert failed. If none is provided it will indicate, for each failed item, that the item must not be null.
whereItFailed: string  Optional parameter specifying where the failure can be found. If none is provided it will print the component address (GameObject->Component->Collection Name).
howToFix: string  Optional parameter suggesting how to fix the problem. If none is provided it will suggest assigning a valid item of the required type to the collection at each missing index.
Returns
void