Custom Event units that derive from EventUnit don't appear in fuzzy finder

D. A. Terre 4 years ago updated 3 years ago 8

Hi, I'm trying to implement a custom event unit that is triggered by an external API callback.

I tried to use the following class definition:

public class OnSourceStateChange : EventUnit, IEvent, IUnityUpdateLoop

This makes my unit invisible in the fuzzy finder. If I make it derive from Unit and implement IEvent myself, then it does appear, and I can add it to my flow graph. If I change it back to EventUnit after it has been added to a graph, it still works! So the problem doesn't seem to be that I can't write my own EventUnit units, only that the fuzzy finder skips anything deriving from EventUnit or that uses one of its attributes (SpecialUnit?) or interfaces.

Any suggestions? Thanks!

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):

you need to place it in there manually, it requires you to set it to the Events category. So just add to the classes [UnitCategory("Events/AnotherSubFolder")]

That doesn't work unfortunately...still missing.

Here's the definition:

public class OnSourceStateChange : EventUnit, IUnityUpdateLoop

And here's the result. As you can see, the event is recognized and even gets the right icon, but doesn't appear in the finder.

You must regenerate units on category change, if you did, try regenerating inspectors. Did you do those?

If it still doesn't work then, it must be a change on the API, if it's 1.4, which I haven't really used much yet.

You're right! My bad. Regenerated and it's there now. Wish I didn't have to keep the events under a separate category from the rest of the API units, but that's a minor complaint at this point.



No problem!

Lazlo said he was thinking of revisiting this when 1.7 comes. So it's definitely possible it can change in the future.


I updated to 1.4 and there seems to be many breaking API changes. I tried to look over the updated source code but haven't yet figured out how to fix many of them. A lot are related to the custom event units I initially posted this question for, so I will continue this thread:

  1. Which is the correct EventUnit -derived class to use as a base class for a custom event unit?
  2. The default implementation of EventUnit registers a hook delegate that fires immediately when the hook name is triggered. How can I add some conditional logic? (ShouldTrigger seems like a good candidate but doesn't look very efficient)
  3. What is the correct way to register callbacks for Update calls, now that IUnityUpdateLoop has been removed?
  4.  Flow.New() now requires a GraphReference, how can I retrieve it from within a unit in a method that didn't receive it as an argument?
  5. this.graph.owner is now missing - how can I get a reference to the MonoBehaviour component running this flow graph?
  6. What is the correct way for starting coroutines once a control input has been triggered?

Thanks, hope that's not too much all at once!