Hello,
This is a semi follow up to my previous post here:
I’ve managed to repo an issue with delegates when they are wrapped with a CDO flag check in the constructor e.g.
if (!HasAnyFlags(RF_ClassDefaultObject))
If the object is C++ derived the delegates stay bound, however if you create a blueprint derived from the C++ class the same delegates are not bound upon play.
I’m not sure what the root cause of this is but I have attached a test project that I used to reproduce the problem.
To test:
- Compile project in either DebugGame Editor or Development Editor
- Open TestMap
- Press Play
- “The delegate was called” should appear on the screen
- Change the default pawn class to BP_TestPawn
- Press Play
- Nothing will happen
Expected Result:
“The delegate was called” should appear on the screen.
If I remove the RF_ClassDefaultObjectcheck the problem doesn’t appear. Is this intentional behaviour? I figured you wouldn’t want to bind delegates to the CDO?
If there is anything else you need from me, please do let me know.
Thanks!