My code look like this:
.h
UFUNCTION(BlueprintCallable, Exec, Category = "MissionConditionBPLibrary")
static bool RandInPercentage(float Val, bool bIsEqual = true);
I add this function to call it
void UMissionConditionBPLibrary::ExecMissionCondition(FString FuncString)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("ExecMissionCondition")));
if (WorldContext == nullptr || !WorldContext->IsValidLowLevel()) {
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("cant ExecMissionCondition")));
}
FOutputDeviceNull ar;
UMissionConditionBPLibrary *MissionConditionBPLib = NewObject<UMissionConditionBPLibrary>(WorldContext, UMissionConditionBPLibrary::StaticClass());
MissionConditionBPLib->CallFunctionByNameWithArguments(*FuncString, ar, nullptr, true);
}
When I play game in editor it is worked! but After I package it can’t exec this function.I don’t know why.Can you help me?