A Bunch of miscellaneous refactoring
This commit is contained in:
@@ -12,7 +12,7 @@ void UlxUtilityLibrary::Assert(bool condition, const FString &message) {
|
||||
}
|
||||
}
|
||||
|
||||
void UlxUtilityLibrary::CallFunctionByName(UObject *object, const FString &namepart1, const FString &namepart2, const FString &fallback) {
|
||||
void UlxUtilityLibrary::CallFunctionByName(UObject *object, const FString &namepart1, const FString &namepart2, const FString &fallback, bool bFailIfNotFound) {
|
||||
FString fullname = namepart1 + namepart2;
|
||||
if (!IsValid(object)) {
|
||||
const FBlueprintExceptionInfo ExceptionInfo(
|
||||
@@ -26,6 +26,9 @@ void UlxUtilityLibrary::CallFunctionByName(UObject *object, const FString &namep
|
||||
if (function == nullptr) {
|
||||
function = object->FindFunction(FName(*fallback));
|
||||
if (function == nullptr) {
|
||||
if (!bFailIfNotFound) {
|
||||
return;
|
||||
}
|
||||
const FBlueprintExceptionInfo ExceptionInfo(
|
||||
EBlueprintExceptionType::FatalError,
|
||||
LOCTEXT("CallFunctionByName_NoSuchFunction", "In CallFunctionByName, cannot find the named function or the fallback function.")
|
||||
|
||||
Reference in New Issue
Block a user