create-interface
Create a Blueprint interface with C++ backing for interactable objects.
SKILL.mdUnrealEngine/skills/create-interface/SKILL.md
GitHubSkill: Create Blueprint & C++ Interface (Unreal Engine 5.9)
Description
Create a Blueprint-accessible C++ interface (UINTERFACE + IInterface) with AgentFrameworkActions.AgentFrameworkCppToolset, or a pure Blueprint Interface asset via BlueprintToolsets.BlueprintToolset.
Arguments
{{arg}}: Interface name (withoutU/Iprefix, e.g.,Interactable)
Steps
Option A: C++ Backing Interface (AgentFrameworkActions.AgentFrameworkCppToolset)
Scaffold class files via
call_toolonAgentFrameworkActions.AgentFrameworkCppToolset.CreateCppClass:ClassName:"{{arg}}"ParentClassName:"Interface"- Optional
ModuleName/SubDirectory
Declare interface methods in
{{arg}}.h:UINTERFACE(MinimalAPI, Blueprintable) class U{{arg}} : public UInterface { GENERATED_BODY() }; class I{{arg}} { GENERATED_BODY() public: UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Interaction") void Interact(AActor* Interactor); };Refresh AST & Compile:
- Call
generate_compile_commandsoncpp-ast-ragso Clang indexes the new header/source files. - Rebuild the Editor target via UBT when adding new
UINTERFACEheaders (or callLiveCodingToolset.LiveCodingToolset.CompileLiveCodingafter editing existing.cppbodies).
- Call
Implement on a C++ actor:
class AMyActor : public AActor, public I{{arg}} { virtual void Interact_Implementation(AActor* Interactor) override; };Call via interface (handles both C++ and Blueprint-implemented interfaces safely):
if (TargetActor && TargetActor->GetClass()->ImplementsInterface(U{{arg}}::StaticClass())) { I{{arg}}::Execute_Interact(TargetActor, this); }
Option B: Implement or Author in Blueprint (BlueprintToolsets.BlueprintToolset)
- Call
BlueprintToolsets.BlueprintToolset.AddInterface(Blueprint,InterfaceClass) to implementU{{arg}}on anyUBlueprintasset, then implement the event graph viaBlueprintToolsets.BlueprintDslToolset.Editand compile withBlueprintToolsets.BlueprintToolset.CompileBlueprint.