A Bunch of miscellaneous refactoring

This commit is contained in:
2024-09-24 22:13:56 -04:00
parent 0b7049cf5a
commit a295ff5e53
13 changed files with 33 additions and 36 deletions

View File

@@ -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.")