hi unreal enthusiasts
Let’s say I have a blueprint function library which has been implemented in blueprint, not in C++. It’s path is “Blueprint’/Game/TMP/MyBlueprintFuncLib.MyBlueprintFuncLib’”, it has a function “MyBlueprintFunc”. I am in a C++ context and I would like to call that function.
What I have been trying so far:
UBlueprint* BlueprintLibPtr = LoadObject<UBlueprint>(NULL, TEXT("/Game/TMP/MyBlueprintFuncLib.MyBlueprintFuncLib"), NULL, 0, NULL); // success, I get a pointer to the function library! UFunction* unrealFunction = BlueprintLibPtrDCO->FindFunction(TEXT("MyBlueprintFunc")); // no success, I can't find the function FOutputDeviceNull nullDevice; BlueprintLibPtr->CallFunctionByNameWithArguments(TEXT("MyBlueprintFunc"), nullDevice, NULL, true)) // no success, says it can't find the function, probably same problem as above
- How can I achieve the function call?
- How do I need to specify the function name for BlueprintLibPtrDCO->FindFunction?
- Could it be that I am trying to make the call too early? (I am calling the code above from a “IModuleInterface::StartupModule” plugin which has LoadingPhase PostEngineInit)
- I know about the “Game Singleton Class”, which delivers actually more or less about what I want to achieve using the above code. However there seem to be a problem if I move the loading phase of the module (a bug maybe?), the engine crashes until I move certain modules back to LoadingPhase Default resp. until I remove the Game Single Class.
many thanks for your help!