🧨Reactions
Last updated
Last updated
Reactions are snippets of code you can add to your scripts to execute more precise logic on the animal or on any components. Instead of using Unity Messages or Unity Events to connect them.
You can add the Reactions Component to any GameObject to access them
Once you have added you can use the React(Component Target)
method to activate it. Whether is via a Unity Event or by code. You need to give the Reaction a Target to apply the reaction.
To create a new Reaction go to the Menu:
Create > Malbers Animations > Reaction Var
To make use of the Reaction Var you can add them to any Unity Event that has a GameObject, Monobehaviour, Transform, or Animal as a parameter.
E.g. You can Disable the Jump State when entering a room ("Box Collider"). and enable it back when exiting:
You can also add a reaction to your code and use it just like any other event.
This is the correct syntax:
You need to add [SerializeReference,SubclassSelector]
to display it right on the inspector.
To call a reaction simply use this code:
You can create your own reactions. Here's a quick example of how to create a reaction that enables or disables a collider: