I declared a BlueprintNativeEvent function in the header and the compiler keeps giving me errors telling me thier is no Myfunction_Implementation()(i wrote this in my cpp file) , but if i change it to MyFunction its no problem. what’s causing this ?
if you declare your BlueprintNativeEvent like such:
UFUNCTION(BlueprintNativeEvent)
void MyFunction;
you also need to implement an _Implementation function that will get called wheni neccessary:
void MyClass::MyFunction_Implementation()
{
//Stub.
}
Specifically, the documentation says: “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.”
This functions serves not only as a base in case no blueprint overrides its implementation, it also serves as the method for C++ programmers to override if they want to.
1 Like