Hello! So today I will continue working with EventNodes! I will go over a couple of ways on how you can run EventNodes. Let’s get started!!

One of the most simple and also handy ways to execute an EventNode is using Unity’s Event Functions (e.g Start, OnEnable, Update). Here’s an example of one of them that fires the EventNode on Start:

I find that having these allows me to fire small events here and there where no other logic matters (i.e. toggling game objects, play particles or audio).

Now I will go over the method I tend to use to run events for gameplay mechanics and that is EventChains! They allow me to change events on the fly and run them from anywhere I want. The EventChain class is similar to the sequence composite in a Behaviour Tree structure, where it runs through a list of nodes. The major difference is that it runs the nodes in a coroutine, making it possible to handle the continue status in nodes. I’ve tried running event chains using the Update function, without using coroutines. However, this method is not very optimal since the Update function is executed every frame, even if you are not ‘using’ it. Here’s what the script looks like:

Anytime I want to execute a chain of events, I just gotta call the execute function. It could be when an entity gets hit, or is destroyed for instance. If you create the right set of event nodes, these could also help you create your own cinematic shots! It is up to you how you want to use these tools! I have also used it in the past to break down input control (i.e. when mouse button is pressed down), however I find that this just makes things a bit more complicated and messy!

This completes the section on data-driven events, however I am thinking that I will go over on examples to show you how you can use global variables in gameplay mechanics or other systems for your game. Until then. 🙂