--- name: unreal-blueprint-automation description: Creates and compiles Blueprints in Unreal Engine 5.8 via Python using phased Silent Execution (components, properties, compile). Use when creating a Blueprint, adding components, setting Blueprint properties, or debugging Blueprint compile crashes. allowed-tools: mcp__ue58-mcp__execute_python_code,mcp__ue58-mcp__call_tool --- # unreal-blueprint-automation **Version:** 2.0.2 **Last Updated:** 2026-09-08 **Dependencies:** Unreal Engine 5.8+, UE 5.8 native MCP (HTTP, port 8000), VibeUE plugin (optional) **Status:** Production Ready > **Preflight first (2026-09-08):** before the first build step of any approved plan, run the `unreal-project-preflight` skill (`ue_preflight.py --live --features --plan-block`) so plugins and project settings this skill depends on are enabled in ONE restart. Mid-task "class not found / plugin not enabled" errors go back to that Step 0, never to a runtime toggle. ## Overview Automate Blueprint creation, component addition, property configuration, and compilation in Unreal Engine 5.8 using the proven **phased execution pattern** that prevents crashes and timeouts. **Key Discovery:** Blueprint compilation triggers async validation that blocks subsequent Python operations. Using **Silent Execution** (no code after compilation) eliminates crashes. ## Quick Start ```python # Phase 1: Create Blueprint (via mcp__ue58-mcp__execute_python_code) import unreal bp = unreal.AssetToolsHelpers.get_asset_tools().create_asset( asset_name="BP_MyActor", package_path="/Game/Blueprints", asset_class=unreal.Blueprint, factory=unreal.BlueprintFactory() ) # Script ends - Silent Execution # Phase 2: Add Component (separate execute_python_code call) import unreal bp = unreal.load_asset('/Game/Blueprints/BP_MyActor') scs = bp.simple_construction_script mesh_node = scs.create_node(unreal.StaticMeshComponent) scs.add_node(mesh_node) print("Component added") # Phase 3: Compile (separate execute_python_code call) import unreal bp = unreal.load_asset('/Game/Blueprints/BP_MyActor') unreal.KismetSystemLibrary.compile_blueprint(bp) # NO CODE AFTER - Silent Execution! ``` **Expected Result:** - Blueprint created at `/Game/Blueprints/BP_MyActor` - Contains StaticMeshComponent - Compiles without errors - Total time: <1 second across all phases ## VibeUE Toolset Alternative When VibeUE is installed, Blueprint operations are also available via toolsets: ``` # Create Blueprint via VibeUE mcp__ue58-mcp__call_tool( toolset_name="VibeUE.BlueprintService", tool_name="create_blueprint", arguments={"blueprint_name": "BP_MyActor", "package_path": "/Game/Blueprints"} ) # Add component via VibeUE mcp__ue58-mcp__call_tool( toolset_name="VibeUE.BlueprintService", tool_name="add_component_to_blueprint", arguments={ "blueprint_name": "BP_MyActor", "component_type": "StaticMeshComponent", "component_name": "MyMesh" } ) ``` Use `mcp__ue58-mcp__describe_toolset(toolset_name="VibeUE.BlueprintService")` to discover available tools. ## Core Concepts ### 1. The Phased Execution Pattern **Problem:** Blueprint compilation triggers async validation that locks the Blueprint and blocks Python access, causing crashes or timeouts. **Solution:** Execute operations in separate `execute_python_code` calls, allowing each async operation to complete before the next phase begins. **4 Phases:** 1. **Create** - Create the Blueprint asset 2. **Configure** - Add components and set properties 3. **Compile** - Trigger Blueprint compilation 4. **Validate** - Check Unreal Output Log (not via Python) ### 2. Silent Execution Derived from PCG automation breakthrough. **Rule:** No Python code after compilation-triggering operations. **Why:** Compilation triggers async validation. Any subsequent Python access attempts to lock the Blueprint, causing crashes. **Example - WRONG:** ```python unreal.KismetSystemLibrary.compile_blueprint(bp) print("Compiled!") # CRASH - Blueprint still validating ``` **Example - CORRECT:** ```python unreal.KismetSystemLibrary.compile_blueprint(bp) # Script exits immediately - validation completes successfully ``` ### 3. Log-Based Validation **Instead of Python verification:** ```python # DON'T DO THIS result = compile_blueprint(bp) if result.success: # Causes crash print("Success") ``` **Use Unreal Output Log:** ``` Look for: LogBlueprint: [BP_MyActor] compiled successfully LogBlueprint: Error: ... (indicates failure) ``` ## Workflows ### Workflow 1: Basic Actor Blueprint **Use Case:** Create a Blueprint with single static mesh component. **Phase 1 - Create Blueprint:** ```python import unreal bp = unreal.AssetToolsHelpers.get_asset_tools().create_asset( asset_name="BP_SimpleActor", package_path="/Game/Blueprints", asset_class=unreal.Blueprint, factory=unreal.BlueprintFactory() ) ``` **Phase 2 - Add Component (via execute_python_code):** ```python import unreal bp = unreal.load_asset('/Game/Blueprints/BP_SimpleActor') scs = bp.simple_construction_script mesh_node = scs.create_node(unreal.StaticMeshComponent) scs.add_node(mesh_node) # Set mesh on component mesh = unreal.load_asset("/Engine/BasicShapes/Cube.Cube") mesh_node.component_template.set_static_mesh(mesh) print("Mesh component added and configured") ``` **Phase 3 - Compile:** ```python import unreal bp = unreal.load_asset('/Game/Blueprints/BP_SimpleActor') unreal.KismetSystemLibrary.compile_blueprint(bp) # Silent Execution ``` **Validation:** Open Blueprint in Unreal Editor, verify component and mesh assignment. ### Workflow 2: Multi-Component Blueprint **Use Case:** Blueprint with multiple components (mesh, light, particle system). **Pattern:** Add all components before compiling. ```python # Phase 1: Create Blueprint (separate call) import unreal bp = unreal.AssetToolsHelpers.get_asset_tools().create_asset( asset_name="BP_ComplexActor", package_path="/Game/Blueprints", asset_class=unreal.Blueprint, factory=unreal.BlueprintFactory() ) # Phase 2: Add Components (separate call) import unreal bp = unreal.load_asset('/Game/Blueprints/BP_ComplexActor') scs = bp.simple_construction_script # Add mesh component mesh_node = scs.create_node(unreal.StaticMeshComponent) scs.add_node(mesh_node) # Add light component light_node = scs.create_node(unreal.PointLightComponent) scs.add_node(light_node) print("Components added") # Phase 3: Compile (separate call) import unreal bp = unreal.load_asset('/Game/Blueprints/BP_ComplexActor') unreal.KismetSystemLibrary.compile_blueprint(bp) # Silent Execution ``` ### Workflow 3: Blueprint with Transform **Use Case:** Position components relative to each other. ```python # After adding components... import unreal bp = unreal.load_asset('/Game/Blueprints/BP_MyActor') scs = bp.simple_construction_script nodes = scs.get_all_nodes() for node in nodes: comp = node.component_template if isinstance(comp, unreal.PointLightComponent): comp.set_editor_property('relative_location', unreal.Vector(0, 0, 200)) elif isinstance(comp, unreal.StaticMeshComponent): comp.set_editor_property('relative_scale3d', unreal.Vector(2, 2, 2)) ``` ### Workflow 4: Spawning Blueprint in Level **Use Case:** Create Blueprint instance in current level. ```python # After Blueprint is compiled and saved... import unreal bp_class = unreal.load_class(None, "/Game/Blueprints/BP_MyActor.BP_MyActor_C") actor = unreal.EditorLevelLibrary.spawn_actor_from_class( bp_class, unreal.Vector(0, 0, 0), unreal.Rotator(0, 0, 0) ) actor.set_actor_label("MyActor_Instance") print(f"Spawned: {actor.get_actor_label()}") ``` ## MCP Tools & Component Types For complete reference on component types and property type safety: - **MCP Tools Reference:** `reference/mcp-tools-reference.md` - **Property Type Safety:** `reference/property-type-safety.md` ## Troubleshooting ### Crash on Compilation **Symptom:** Unreal Editor crashes when running compile_blueprint() **Cause:** Python code after compilation tries to access locked Blueprint. **Fix:** Use Silent Execution pattern: ```python import unreal bp = unreal.load_asset('/Game/Blueprints/BP_MyActor') unreal.KismetSystemLibrary.compile_blueprint(bp) # NO CODE AFTER THIS LINE ``` ### Component Not Added **Symptom:** Component not visible in Blueprint. **Debugging:** 1. Check Unreal Output Log for errors 2. Verify Blueprint exists: `unreal.load_asset('/Game/Blueprints/BP_MyActor')` 3. Try opening Blueprint manually in Unreal Editor ### Property Not Set **Symptom:** Property set but unchanged. **Debugging:** 1. Check property name spelling (case-sensitive) 2. Verify property value format 3. Check if property is editable on component ### Timeout on MCP Commands **Symptom:** MCP command hangs for 30+ seconds. **Cause:** Blueprint Editor open with target Blueprint (blocks operations). **Fix:** Close Blueprint Editor tab before running automation. ## Performance Notes **Typical Execution Times:** - Create Blueprint: <100ms - Add Component: <200ms - Set Property: <100ms - Compile: <500ms **Optimization Tips:** 1. Batch component additions in single phase 2. Group property settings together 3. Compile once at the end (not after each change) ## Validation Checklist After running automation, verify in Unreal Editor: - [ ] Blueprint asset exists at expected path - [ ] All components visible in Components panel - [ ] Component properties set correctly - [ ] Blueprint compiles without errors - [ ] Blueprint can be placed in level and runs correctly ## Reference Documentation **For detailed information:** - `reference/mcp-tools-reference.md` - Component types reference - `reference/property-type-safety.md` - Property type safety and crash prevention - `.claude/skills/unreal-pcg-automation/` - PCG automation (same Silent Execution patterns) ## Constitutional Compliance **Article I:** All scripts work on any Blueprint in any project (no hardcoded paths) **Article III:** SKILL.md under 500 lines, reference docs on-demand **Article IV:** All workflows tested in clean Unreal level **Article V:** Uses Unreal's AssetTools API and KismetSystemLibrary ## Version History **2.0.0 (2026-07-06):** - Migrated from community MCP (localhost:55557) to UE 5.8 native MCP (HTTP, port 8000) - Replaced all `from unreal_mcp_server import get_unreal_connection` / `send_command()` patterns with direct Python via `execute_python_code` - Added VibeUE toolset alternative for Blueprint operations - Updated version references from 5.5 to 5.8 **1.1.0 (2025-12-03):** - Refactored to Article III compliance (<500 lines) - Moved MCP tools reference to separate file - 33% context reduction through progressive disclosure **1.0.0 (2025-10-26):** - Initial release with 4-phase pattern and Silent Execution