Mandatory parameter in C++ defined blueprint functions

We have blueprint functions defined in C++ that take parameters that are derived from UObject. Currently we have to check every parameter for NULL to avoid crashes when using them. It would be way more convenient to have the blueprint compiler check those parameters and raise a compile error if one of those parameters is not connected.

Apparently there is functionality for this kind of parameter check somewhere, as for certain parameter types such errors occur. Is there some way to mark a parameter as mandatory or to prevent NULL/None inputs?


Try passing the parameters as references and the Blueprint compiler will raise an error if they are NULL:

Simple UFunction example:

static void UsingMyUOBJ ( UPARAM(ref)MyObjType &MyOBJ );

void MyBPLib::UsingMyUOBJ ( UPARAM(ref)MyObjType &MyOBJ ) {
    //doing stuff with the UObj

Note:: I haven’t tested this, maybe works for your needs, maybe not.

works as desired. thanks! :smiley: