It says here that you can declare a const delegate with “_CONST”, however it doesn’t seem to work for me.
DECLARE_DYNAMIC_DELEGATE(FDelegateName);
works just fine, however
DECLARE_DYNAMIC_DELEGATE_Const(FDelegateName);
spits out compile errors.
Error 1 error C2065: 'FDelegateName' : undeclared identifier
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Does anybody have any idea how to get this working?
Yeah, I didn’t either. Was it deprecated perhaps? Trouble is I can find absolutely no examples or references for const function delegates other than that documentation.
Are you using the _Const inside of square brackets? Try using DECLARE_DYNAMIC_DELEGATE[_Const](FDelegateName) and let me know if you still get compile errors.
The bug report mentioned is still open and unresolved. It may be helpful to look at the DelegateSignatureImpl.inl file of the engine for examples on adding UObject-based function delegates.
There used to be a _Const version of the delegate signature, but it hasn’t existed for some time (since late 2012 actually). We apparently didn’t update the documentation to reflect this. We just fixed it locally and it will be live shortly.
Sorry for any confusion that caused. Outdated documentation is a horrible thing, but it does happen with a codebase this large that changes so frequently.