I have declared a multicast delegate like so:
DECLARE_MULTICAST_DELEGATE(FDelegateType);
FDelegateType MyDelegate;
but when I try to add a function to this delegate
MyDelegate.AddUObject(this, &SomeClass::SomeFunction);
it causes Unreal to crash with the following error:
Access violation - code c0000005 (first/second chance not available)
UE4Editor_Unreal!FMulticastDelegateBase<FWeakObjectPtr>::CompactInvocationList() [c:\program files\epic games\ue_4.18\engine\source\runtime\core\public\delegates\multicastdelegatebase.h:159]
UE4Editor_Unreal!FMulticastDelegateBase<FWeakObjectPtr>::AddInternal() [c:\program files\epic games\ue_4.18\engine\source\runtime\core\public\delegates\multicastdelegatebase.h:146]
UE4Editor_Unreal!TBaseMulticastDelegate<void>::AddUObject<UHUDScoreBar>() [c:\program files\epic games\ue_4.18\engine\source\runtime\core\public\delegates\delegatesignatureimpl.inl:837]
Specifically, the variable InvocationListLockCount (a mutable int) in MulticastDelegateBase.h has a null value.
It seems as though the delegate has not been initialized, but I am unsure why.
Any help would be appreciated.