What's the deal with the "delegate" type in blueprints?

The “delegate” type in blueprints seems pretty useful, but it looks like it has some really strange restrictions. Like, I can’t select it as a type in a function input parameter, however, I can add it as an input if I drag an event line over to the input node? And I’d love to have a variable on an actor that’s an array of delegates, but that doesn’t seem to be possible either? Does anyone know what the deal is with this partially hidden type?

Hey @WhaleFood! Welcome to the forum!

So a “Delegate” is extremely similar to an “Event Dispatcher” but the difference is an “Event dispatcher” is much more commonly used in Blueprint. If I remember correctly, Delegates in Blueprint are used to call C++ functions.

Here, check out this page about actor communication, and use the toggle at the top to switch from BP to C++ and you’ll notice they switch out :slight_smile:

Thanks @Mind-Brain. I’m working on a dialog system for my game, so I really need an array of these things. It doesn’t seem to be possible to make an array of dispatchers, but you can do an array of delegates (at least as function input). However it seems like the only way to get at that is through this hack of dragging a connection onto the input node of a function. So if the type exists, it seems like there should be some way of getting to it to use as an actor variable? But maybe I really should just break out the C++ for this

I see. For a dialog system? Like a telltale style game or maybe fallout?

For something like a dialog system, if there’s a lot of dialogue, I would suggest using a Data Table with String variables and audio cue variables. The thing is, delegates and dispatchers are kind of just like… mailboxes.

BUT it’s possible you could just use a BLUEPRINT INTERFACE instead! That’s KIND of like an array and network of dispatchers! Check that Actor communication link I left above about it, and check this video out!

Disclaimer: this link is not affiliated with Epic Games, Unreal Engine, or their partners.

Thanks. The delegates are for custom actions that I want my dialog to be able to trigger. But I think your suggestion of interfaces is probably the way to go. Or just make a custom object-based blueprint with a single event dispatcher which I can make an array of. Cheers!