Daily Unreal Column #78 - Core Delegates
Writing gameplay or editor code that needs to react to some user action is very inconvenient if there is no delegate notifying us that something has happened. Here is where to find useful delegates.
As mentioned in the intro paragraph, when it comes to reacting to some user or engine action the most convenient thing is to have a delegate that we can subscribe to and act upon.
There is a CoreDelegate.h
header file where we can find a lot of useful delegates. Go ahead and explore yourself while I will bring just few examples here.
Here is a delegate broadcasted when GConfig
is ready to use.
DECLARE_MULTICAST_DELEGATE(FConfigReadyForUse);
static FConfigReadyForUse ConfigReadyForUse;
Here is a delegate that allows us to add our own message to the viewport, similar to the “Lightning needs to be rebuilt” message we can often see.
DECLARE_MULTICAST_DELEGATE_OneParam(FGetOnScreenMessagesDelegate, FSeverityMessageMap&);
static FGetOnScreenMessagesDelegate OnGetOnScreenMessages;