Unreal blueprint codegen
Production-ready Claude Code skills for Unreal Engine 5, llama.cpp, and OpenCode CLI integration. Built by maystudios.
npx -y skills add maystudios/claude-skills --skill unreal-blueprint-codegenAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 13 stars13 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Programmatically generate Unreal Engine 5.x Blueprint and Widget Blueprint .uasset files from C++. Use when building a content generator for Fab/Marketplace samples, Quick-Start kits, tutorial assets, or editor utilities that mass-produce Blueprints, Widget Blueprints with UMG animations, or domain assets (dialogue, quest, ability data). Covers UBlueprint creation with full event-graph authoring (UK2Node_*, FBlueprintEditorUtils), UWidgetBlueprint hierarchies, UWidgetAnimation with MovieScene tracks and keyframes, two-pass compile, and the K2Node spawn idiom. Triggers on "create a Blueprint generator", "generate WBP from C++", "programmatically author event graph", "build dialogue/quest assets from code", "editor utility to generate marketplace samples", or any task involving FKismetEditorUtilities::CreateBlueprint, UWidgetBlueprintFactory, FBlueprintEditorUtils::AddMemberVariable, or UMovieScene2DTransformTrack.
SKILL.md
12.8 KB, as published. Nobody here has run it
Unreal Engine Blueprint Code Generation (UE 5.4–5.7)
Generate complete .uasset files (Blueprints, Widget Blueprints, domain assets) from C++ in an editor module. Validated against UE 5.7. Most patterns work back to 5.4.
When this skill applies
User wants to author asset content programmatically — variables, function graphs, event-graph wiring, widget hierarchies, UMG animations, custom asset graphs — instead of clicking through the editor. Typical use case: generating Marketplace sample content (Quick-Start, walkthrough, demo conversations) so it can be regenerated reproducibly instead of hand-pruning binary .uasset files.
If the user only wants runtime widget instantiation (CreateWidget / WidgetTree->ConstructWidget at game time), this skill is overkill — that's just normal UMG.
Hard prerequisites
- C++ editor module with
Type=Editor(orUncookedOnly). Python cannot author event graphs —UEdGraph/UK2Node_*are not exposed. Set up aUBlueprintFunctionLibraryin C++ and call its UFUNCTIONs from Python if a Python entry point is needed. - Module must depend on at least:
UnrealEd,BlueprintGraph,Kismet,KismetCompiler,AssetTools,AssetRegistry. AddUMG,UMGEditor,MovieScene,MovieSceneTracksfor Widget Blueprints. See assets/experiment-module-template/ for a working.Build.cs. - IWYU: include each engine header explicitly. Forward-declare
UPackage/UObjectetc. in your own headers; pull full headers in.cpponly.
The 30-second mental model
Asset = UPackage + UObject (e.g. UBlueprint / UWidgetBlueprint / UMyAsset)
|
+-- source UEdGraph (editor-only, what designers see)
| +-- UK2Node_* / UEdGraphNode_* (the boxes)
| +-- UEdGraphPin (the wires)
|
+-- generated UClass <- produced by CompileBlueprint
+-- FProperty / UFunction (what code uses at runtime)
Spawn editor nodes onto a graph, wire their pins, then call CompileBlueprint to bake the generated class. Save the package.
Decision tree
| Goal | Read |
|---|---|
| Add variables, functions, custom events, math nodes to a regular Blueprint | references/k2node-cookbook.md |
| Build a Widget Blueprint with widget hierarchy | references/widget-blueprint-cookbook.md |
| Add UMG animations (UWidgetAnimation + MovieScene tracks/keyframes) from C++ | references/widget-blueprint-cookbook.md |
The compiler says "function not found", FindPinChecked asserts, or a node has no pins | references/two-pass-compile.md — read before debugging |
| Need a working module skeleton to start from | assets/experiment-module-template/ |
| Hit a weird Engine API quirk or version-specific issue | references/caveats.md |
Standard workflow
For every generator function:
- Create / load package:
CreatePackage(*FullPath)thenPackage->FullyLoad(). - Create the asset with
FKismetEditorUtilities::CreateBlueprint(...)(covers bothUBlueprintandUWidgetBlueprint— pass the right Blueprint class + GeneratedClass). - Build content — variables, function graphs, widget tree, animations.
- Wire event graph / call user functions — only AFTER an intermediate compile if the wiring references content created in step 3 (see two-pass-compile.md).
MarkBlueprintAsStructurallyModified+CompileBlueprint— once at the end (or twice, two-pass).- Save:
FAssetRegistryModule::AssetCreated(Asset)+Package->MarkPackageDirty()+UPackage::SavePackage(...).
Skeleton:
#include "Engine/Blueprint.h"
#include "Kismet2/BlueprintEditorUtils.h"
#include "Kismet2/KismetEditorUtilities.h"
#include "AssetRegistry/AssetRegistryModule.h"
#include "UObject/SavePackage.h"
UBlueprint* CreateBP(const FString& PackagePath, const FString& AssetName, UClass* ParentClass)
{
const FString FullPath = PackagePath / AssetName;
UPackage* Package = CreatePackage(*FullPath);
Package->FullyLoad();
UBlueprint* BP = FKismetEditorUtilities::CreateBlueprint(
ParentClass, // e.g. AActor::StaticClass() or UUserWidget::StaticClass()
Package,
FName(*AssetName),
BPTYPE_Normal,
UBlueprint::StaticClass(), // or UWidgetBlueprint::StaticClass()
UBlueprintGeneratedClass::StaticClass(), // or UWidgetBlueprintGeneratedClass::StaticClass()
FName("MyGenerator")); // calling-context tag; any FName
// ... build content here ...
FBlueprintEditorUtils::MarkBlueprintAsStructurallyModified(BP);
FKismetEditorUtilities::CompileBlueprint(BP);
FAssetRegistryModule::AssetCreated(BP);
Package->MarkPackageDirty();
const FString Filename = FPackageName::LongPackageNameToFilename(
Package->GetName(), FPackageName::GetAssetPackageExtension());
FSavePackageArgs Args;
Args.TopLevelFlags = RF_Public | RF_Standalone;
UPackage::SavePackage(Package, BP, *Filename, Args);
return BP;
}
Critical rules (read these even if skipping cookbooks)
1. SetExternalMember BEFORE AllocateDefaultPins on UK2Node_CallFunction
UK2Node_CallFunction* Node = NewObject<UK2Node_CallFunction>(Graph);
Node->FunctionReference.SetExternalMember(
GET_FUNCTION_NAME_CHECKED(UKismetSystemLibrary, PrintString),
UKismetSystemLibrary::StaticClass());
Node->AllocateDefaultPins(); // AFTER. Reverse and the node spawns pinless.
Same rule for UK2Node_VariableSet/Get: set the variable reference first, then AllocateDefaultPins.
2. MarkBlueprintAsStructurallyModified vs Modified
- StructurallyModified: any node added/removed, any variable added/removed, any pin topology change. Forces class layout regen.
- Modified: only property tweaks on existing nodes/vars (e.g. changed a default value).
For codegen, almost always use MarkBlueprintAsStructurallyModified.
3. Function calls must be in the exec chain or get pruned
Non-pure functions (with exec pins) must be wired into the exec chain. If you connect their data output without wiring exec, the BP compiler prunes the call and the data pin reads default. Symptom: warning "X was pruned because its Exec pin is not connected".
// WRONG — Compute is non-pure, exec not wired, gets pruned:
EvtThen->MakeLinkTo(SetCounter->GetExecPin());
ComputeRet->MakeLinkTo(CounterValPin); // reads default, not actual return
// RIGHT — Compute in the chain:
EvtThen->MakeLinkTo(CallCompute->GetExecPin());
CallCompute->GetThenPin()->MakeLinkTo(SetCounter->GetExecPin());
ComputeRet->MakeLinkTo(CounterValPin);
4. Avoid (0,0) — auto-spawned default events live there
Both AActor-based BPs and Widget Blueprints auto-spawn placeholder events (BeginPlay, Tick, ActorBeginOverlap, PreConstruct, Construct) at (0, 0). Position your nodes well off, e.g. Y=-300, X=-400. Otherwise the user opens the asset to a tangled mess.
5. Two-pass compile when nodes reference newly-created content
If you create a function Compute and then wire CallCompute referencing it in the same pass, AllocateDefaultPins on CallCompute runs before Compute is reflected on the generated class — the pins for InValue/ReturnValue won't exist, and FindPinChecked asserts. Fix: compile after building the function, then wire the call. Same for UMG animations referenced via UK2Node_VariableGet. See references/two-pass-compile.md.
Common UE 5.7 gotchas (full list in caveats.md)
PlayAnimationByNamedoes NOT exist onUUserWidgetin 5.7. OnlyPlayAnimation(UWidgetAnimation*, ...). Wire viaUK2Node_VariableGetfor the animation, not a string.- Animation
FNamemust equal display label.UUserWidget::GetAnimationByNamematchesGetFName(). Set both:NewObject<UWidgetAnimation>(WBP, FName("SlideIn"), ...)plusAnim->SetDisplayLabel(TEXT("SlideIn")). Outerhierarchy is load-bearing.UWidgetAnimation's outer must be the WBP.UMovieScene's outer must be the animation. Wrong outer → animation does not appear in the editor's Animations panel.UE_DEFINE_GAMEPLAY_TAG_STATICfor any tags the generated assets reference. RuntimeUGameplayTagsManager::AddNativeGameplayTagfrom inside a generator function is too late — the editor UI's tag tree is already built. Register at module load.- Python cannot reach
UEdGraph/UK2Node_*. The only way to author event graphs is C++. Expose your generator asBlueprintCallableUFUNCTIONs on aUBlueprintFunctionLibraryif Python invocation is desired. FBlueprintEditorUtils::AddFunctionGraphdoes NOT spawn a Result node by default. Only Entry. If your function returns a value, manually create one withFGraphNodeCreator<UK2Node_FunctionResult>.
Quick FEdGraphPinType cheat sheet
FEdGraphPinType T;
T.PinCategory = UEdGraphSchema_K2::PC_Boolean; // bool
T.PinCategory = UEdGraphSchema_K2::PC_Int; // int32
T.PinCategory = UEdGraphSchema_K2::PC_Real;
T.PinSubCategory = UEdGraphSchema_K2::PC_Float; // float
T.PinSubCategory = UEdGraphSchema_K2::PC_Double; // double
T.PinCategory = UEdGraphSchema_K2::PC_String; // FString
T.PinCategory = UEdGraphSchema_K2::PC_Name; // FName
T.PinCategory = UEdGraphSchema_K2::PC_Text; // FText
T.PinCategory = UEdGraphSchema_K2::PC_Object; // object ref
T.PinSubCategoryObject = AActor::StaticClass(); // (with target class)
T.ContainerType = EPinContainerType::Array; // wrap as TArray<>
T.ContainerType = EPinContainerType::Set; // TSet<>
T.ContainerType = EPinContainerType::Map; // TMap<> (PinValueType for value)
Use with: FBlueprintEditorUtils::AddMemberVariable(BP, FName("MyVar"), T, FString(TEXT("DefaultValueAsString")));
Workflow checklist
When implementing a generator from this skill:
- Confirm the editor module exists with the right dependencies (template in assets/experiment-module-template/).
- Read references/k2node-cookbook.md for the patterns relevant to the asset type.
- For Widget Blueprints, also read references/widget-blueprint-cookbook.md.
- If wiring crosses content created in the same function, plan the two-pass compile structure (references/two-pass-compile.md).
- Check references/caveats.md for known traps before assuming new behavior is a bug.
- Test by building the editor target, opening the editor, calling the UFUNCTION (often via Python in the Output Log), and visually inspecting the asset.
- Iterate: when a node looks wrong (red error border, missing pin, "X pruned" warning, default values where data should flow), the answer is almost always one of: missing exec wire, wrong allocation order, missing two-pass compile, or wrong pin name.
What this skill does NOT cover
- Cooking / packaging the generated assets — they are regular
.uassetfiles, ship like any other. - Editor Utility Widgets / Blutilities — you can call your generator UFUNCTIONs from those, but designing the EUW is separate UMG work.
- Runtime UMG —
CreateWidget,AddToViewport, animationPlayAnimationcalls in game code. That is not codegen. - Custom UEdGraph schemas — if generating into a domain-specific graph (dialogue, quest, ability tree), use the plugin's own compiler entry point. Static compiler classes are often non-exported, so call the graph's update method (e.g.
UMyGraph::UpdateAsset()) instead of the static compiler if linkage fails.