UnityEvents are wonderful and I’m really enjoying working with them. But I’ve hit upon a need that might be achievable and I’m not too sure.
What I’d like to make is a custom UnityEvent that has open Object/Function slots, just like UnityEvents themselves, but it gets used for checking conditions first. If the conditions in those slots are all met or not, it invokes different UnityEvents. I guess you might call it an If-Event?
For example, I might have two scripts with bools on them and one of these hypothetical 'If-Event’s. I attach it to a GameObject and in the Inspector, press the little + icon twice to create two slots and drag the two script instances in, select the bool from the drop-down list (just like a standard UnityEvent) and then tick both boxes. That’s setting the conditions.
Then below would be two UnityEvent slots called True and False, and I plug some Debug.Log functions in that read “true” or “false” respectively. When this If-Event gets invoked, it checks if both bools are set to true and if so, it fires the ‘True’ event listeners. Otherwise, it invokes the ‘False’ event.
I haven’t seen anything like this yet but I feel like it would be a really powerful tool for my team’s designers to be able to use. Does anyone know if something like this already exists and if not, if there’s a way to access those modular Object/Function slots found in UnityEvents so I could try and custom build it myself? Any insight would be greatly appreciated!