[PLUGIN] Custom Events

So for a singleton class from a plugin I’d like to be able to place certain events freely anywhere.

Just like “Event Begin Play” that can be placed anywhere with prior connections in a blueprint and that is called when the plugin determines to fire the event.

Does anyone know how to do this? The DECLARE_EVENT stuff doesn’t work at all, my event doesn’t even show in the editor when I reload it.

I have had limited success with DECLARE_DYNAMIC_MULTICAST_DELEGATE(…), but I do need to bind the delegate from an instance of the class, which isn’t ideal.

What I really want is to be able to use it like “Event Begin Play” or similar engine events. Without having to have the workflow go through a bind/assign. The idea is to have the plugin do various things like connect it to a server in the background and fetch data asynchronously, hence the events. So if the connection is interrupted it can fire a disconnect event, and the UI can reflect this, until it automatically reconnects and fires the connected event.

The way I’ve done this with my plugins is to add a custom plugin component and assign an interface to the blueprint of choice. The component will automatically assign its owner as the target for interface events at OnRegisterComponent and it will automatically tick to drive the event calls. The end result is that your blueprint can respond to any of the events declared in the interface without any additional wiring. If you also allow the delegate to be reassigned you could change the blueprint that responds to the events to be different than the one that owns the component. I believe epic is leaning toward blueprint assignable events, but I’m not convinced its better than a specific component + interface for a large number of events.

See any of the plugin in my signature for examples.