diff --git a/Source/OUURuntime/Public/GameplayTags/TypedGameplayTag.h b/Source/OUURuntime/Public/GameplayTags/TypedGameplayTag.h index e721f63..9b0c3ed 100644 --- a/Source/OUURuntime/Public/GameplayTags/TypedGameplayTag.h +++ b/Source/OUURuntime/Public/GameplayTags/TypedGameplayTag.h @@ -114,9 +114,13 @@ struct TTypedGameplayTag TIsDerivedFrom::Value, "BlueprintStructType must be derived from FGameplayTag"); + // I did not find a cross-compiler way to implement this check yet, but if all the tag usage is fine with + // Windows / MSVC, it should also be ok on other platforms. +#if PLATFORM_WINDOWS static_assert( TOr...>::Value, "Can only assign from a literal gameplay tag that is nested under any of the InRootLiteralTagTypes"); +#endif return true; } diff --git a/Source/OUURuntime/Public/Templates/InterfaceUtils.h b/Source/OUURuntime/Public/Templates/InterfaceUtils.h index 8d9b7a8..b458749 100644 --- a/Source/OUURuntime/Public/Templates/InterfaceUtils.h +++ b/Source/OUURuntime/Public/Templates/InterfaceUtils.h @@ -6,6 +6,7 @@ #include "Templates/Casts.h" #include "UObject/ScriptInterface.h" +#include "UObject/WeakInterfacePtr.h" /** * Call a function on a blueprint implementable interface object. @@ -86,6 +87,13 @@ UObject* GetInterfaceObject(TScriptInterface InterfaceObject) return InterfaceObject.GetObject(); } +/** Get the underlying object from an interface so you can call Execute_* functions on it */ +template > +UObject* GetInterfaceObject(TWeakInterfacePtr InterfaceObject) +{ + return InterfaceObject.GetObject(); +} + /** * Validate an interface object based on it's underlying UObject, extending IsValid(UObject*) functionality. * Also checks if the object actually implements the target interface. @@ -122,6 +130,12 @@ FORCEINLINE bool IsValidInterface(TScriptInterface& InterfaceObject) return bResult; } +template > +FORCEINLINE bool IsValidInterface(const TWeakInterfacePtr& InterfaceObject) +{ + return InterfaceObject.IsValid(); +} + /** Override to throw compile time error for using const TScriptInterface or const TScriptInterface& */ template > FORCEINLINE bool IsValidInterface(const TScriptInterface& InterfaceObject)