- Create a class. Doesn’t particularly matter what type of class, as long as it can have
UFUNCTION
s defined inside of it. - Define a
UFUNCTION(BlueprintImplementableEvent) virtual void DoAThing();
- This fails, with an error message suggesting that you should use
BlueprintNativeEvent
instead. Change it toBlueprintNativeEvent
. - This fails, with an error message stating that
BlueprintNativeEvent
s can’t be virtual.
This means they can’t be overridden in C++, unless Unreal does some seriously stupid language hacking, in which case this should be documented, but here are the entirety of the docs pages on BlueprintNativeEvent:
This function is designed to be overridden by a Blueprint, but also has a native implementation. Provide a body named [FunctionName]_Implementation instead of [FunctionName]; the autogenerated code will include a thunk that calls the implementation method when necessary.
and BlueprintImplementableEvent:
The function can be overridden in a Blueprint or Level Blueprint graph.
Nothing about virtual
not being necessary to make it overrideable in C++, nothing about any way to do both… just nothing.
So, in short, either the error messages are misleading – which is a bug, hence this being a bug report – or the documentation needs to be updated – which I’m considering a bug so I don’t need to file this in two separate places, which would probably just be irritating for everyone. Either that or I’m missing some annotation which allows a method to be overridden in both C++ and Blueprints, without having to make separate, extra methods to wrap both and do some fancy logic of my own, since the only reason I’m using Unreal instead of writing everything from scratch is to get that kind of repetitive stuff taken care of for me.