Create your own Condition
Find the script TemplateCondition in your Project window (under Scripts > Interactions > Conditions) duplicate it and rename the duplicated file with your condition name [YourConditionName]. Once this is done, open the file for editing.
Rename the class name from:
to:
IMPORTANT: the name you gave to the file and the name of the class need to be the same.
The whole logic of a condition revolves around calling the Validate function to tell the system your condition has been validated. Outside of the functions you see in the template, you will need to implement your own logic that will call Validate based on some requirements you defined.
You also need to fill up the three functions Setup, Dispose and Reload with logic.
Setup will be called before your condition is actually checked for validation. Use this function to prepare the things required for its validation.
Dispose is basically the opposite of Setup and undoes what was done in setup so that the condition does not accidentally validate again.
Typically the Setup and Dispose are usually called in a loop if your condition is reloaded several times.
Reload can have some custom logic of your choosing, but it is usually solely made for calling Invalidate which simply tells the system the condition is now ready for validation again.
You can then use your custom CONDITION inside any Interaction through the Add Component menu.
Last updated