setup_hit_material_swap
Set up hit-triggered material swap and destruction for a Blueprint actor: first hit changes its material, additional hits spawn an explosion and destroy the actor.
Instructions
Set up a full hit-detection + material swap interaction as in Ch. 5.
Creates the complete "cylinder target" interaction:
Event Hit -> track hit count
First hit: swap to hit material
Second+ hit: spawn explosion effect + sound + destroy actor
Args: blueprint_name: Blueprint to modify (e.g., "BP_CylinderTarget") mesh_component: Static mesh component name default_material_path: Original material path hit_material_path: Material to apply on first hit (e.g., M_TargetRed) hit_count_to_destroy: Number of hits before destruction (default 2)
KB: see knowledge_base/08_MATERIALS_AND_RENDERING.md#overview Example: setup_hit_material_swap(blueprint_name="/Game/MCP_Test/BP_Example")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| blueprint_name | Yes | ||
| mesh_component | No | StaticMeshComponent | |
| hit_material_path | No | ||
| hit_count_to_destroy | No | ||
| default_material_path | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |