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

AssertUtils Class

Public Statics

static const string HiglightColor[Get]

Static Member Functions

Asserts that the expression is True.
In case of failure, it will print an error showing where the failure happened.
Parameters
component
The component to which the value expression belongs
value
The expression that should be true
whyItFailed
Optional parameter specifying the reason the assert failed
whereItFailed
Optional parameter specifying where the failure can be found. If none is provided it will print the component address (GameObject->Component).
howToFix
Optional parameter suggesting how to fix the problem.
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.
Others
TValue
The type of Aspect to be checked
Parameters
component
The component requiring this Aspect
aspect
The Aspect to be checked
aspectLocation
The expected location of the Aspect
whyItFailed
Optional parameter specifying the reason the assert failed. If none is provided it will print the expected aspect type and location.
whereFailed
Optional parameter specifying where the failure can be found. If none is provided it will print the component address (GameObject->Component).
howToFix
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.
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.
Others
TValue
The type of field to be checked
Parameters
component
The component to which this field belongs.
value
The value of the field.
variableName
The printed name of the serialized field.
whyItFailed
Optional parameter specifying the reason the assert failed. If none is provided it will indicate that the field value was null.
whereItFailed
Optional parameter specifying where the failure can be found. If none is provided it will print the component address (GameObject->Component->Field Name).
howToFix
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.
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.
Others
TValue
The type of the items in the collection.
Parameters
component
The component to which this collection belongs.
value
The value of the collection.
variableName
The printed name of the serialized collection.
whyItFailed
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
Optional parameter specifying where the failure can be found. If none is provided it will print the component address (GameObject->Component->Collection Name).
howToFix
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.
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.
Others
TValue
The type of the items in the collection
Parameters
component
The component to which the collection belongs.
value
The value of the collection.
variableName
The printed name of the serialized collection.
whyItFailed
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
Optional parameter specifying where the failure can be found. If none is provided it will print the component address (GameObject->Component->Collection Name).
howToFix
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.
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.
Parameters
component
The component to which the collection belongs.
value
The value of the collection.
variableName
The printed name of the serialized collection.
whyItFailed
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
Optional parameter specifying where the failure can be found. If none is provided it will print the component address (GameObject->Component->Collection Name).
howToFix
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.
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.
Parameters
variableName
The variable name as used in code
Returns
The nicified variable
Did you find this page helpful?
Thumbs up icon
Thumbs down icon