copy_dynamic_mesh_to_static_mesh
Copy a DynamicMeshActor's live dynamic mesh into an existing /Game UStaticMesh LOD, overwriting the target LOD in place so it can be saved as a static asset.
Instructions
Write the live dynamic mesh of a DynamicMeshActor INTO an EXISTING /Game UStaticMesh asset's LOD via UGeometryScriptLibrary_StaticMeshFunctions::CopyMeshToStaticMesh (7-arg V2, bUseSectionMaterials=true; engine-default options). Editor-only (the engine function is WITH_EDITOR-gated and touches GEditor + FlushRenderingCommands). Idempotent: overwrites the target LOD in place, no duplication. HONEST GATES: the target asset must already exist (create it first, e.g. via create_editable_static_mesh) and must NOT live under /Engine/ (the engine refuses to modify built-in engine assets). A lod_index outside 0 to 7 (a static mesh has at most 8 LODs) is an error checked before anything changes; one past the asset's last LOD adds the LODs in between, which the engine sets up to be reduced from an earlier LOD.
Returns: { actor_name, target_static_mesh_path, lod_index, outcome_success: bool, source_triangle_count, material_count: int, replaced_materials: bool, wrote: bool }. NOTE: this marks the target package dirty (transaction) but does NOT save to disk — persistence requires a separate save (e.g. via save_asset).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lod_index | No | Optional target LOD index, 0 to 7 (default 0); a negative index or one of 8 or more is refused. | |
| materials | No | Optional ordered list of UMaterialInterface content paths, one per MaterialID (index 0 = MaterialID 0). Supplying it flips bReplaceMaterials on, so the target asset gets exactly these material slots. WITHOUT this the asset keeps its existing slots and a multi-MaterialID mesh collapses into whatever slots already existed — this is the parameter that makes per-triangle MaterialIDs visible on the saved asset. | |
| actor_name | Yes | Label or name of the source DynamicMeshActor. | |
| material_slot_names | No | Optional slot names matching materials 1:1 (default: the engine names them). Ignored when materials is absent. | |
| target_static_mesh_path | Yes | Content path of an EXISTING /Game UStaticMesh to overwrite. |