Last active
July 28, 2024 18:21
-
-
Save Delaunay/4d91143d5e8c7eca34adfe1e678499ab to your computer and use it in GitHub Desktop.
UnrealEngine C++ interface
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UMyInterface::UMyInterface(const FObjectInitializer &ObjectInitializer): | |
Super(ObjectInitializer) | |
{ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "UObject/Interface.h" | |
namespace utils { | |
inline bool ImplementsInterface(UObject* Object, UClass* Interface) { | |
return Object && Object->GetClass()->ImplementsInterface(Interface); | |
} | |
} | |
UINTERFACE() | |
class PROJECT_API UMyInterface : public UInterface | |
{ | |
GENERATED_UINTERFACE_BODY() | |
}; | |
class PROJECT_API IMyInterface | |
{ | |
GENERATED_IINTERFACE_BODY() | |
//! BP Implementable | |
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "MyInterface") | |
UObject* GetObject(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment