UE5 Pointer To Delegate As Class Variable

You Cannot Set A Member Variable As A Pointer To A Delegate

Almost all the time, you want a reference to unreal engine delegates, not a copy. At this point you may have tried and attempted to do something like:


FSomeDelegate* delegatePtr;


FSomeDelegate& delegateRef;


This will not work and Visual Studio will have warned you even before building or as building errors. Specifically for the Pointer type, You may get the error: 


cannot have an exposed pointer to this type.


and for the reference method , you may get a build error saying something along the lines of: 


references must be initialized.


That is because in c++ a reference needs to be set at declaration.

The Workaround

A solution that often works is to get a pointer to the UObject* that contains the unreal engine delegate. The downside is you will need to go through this UObject* to access the delegate every time in code but it’s a small tradeoff. Here is an example of calling the Broadcast function through the UObject.



Welcome to our audio and rhythm plugins collection! With MidiEngine, you can easily import MIDI files and use midi events to create engaging rhythm gameplay or enhance your videos.


Plugin that helps add UMG Widgets to Level Sequences for Text Layers, Movie Titles, 2D layers and more… directly within sequencer. Cross platform.


Let your end users Split And Resize The UI at runtime. Perfect for both games and Applications.

Consider investing in some of our plugins. They might save you some time.  Also helps supports these tutorials.

Instantly get access to our plugins like Blender Curves Importer and UMG Cinematics and more when  you support us on Patreon!

 Join Us On Discord For More Daily Tips!