duplicate_asset
Copies an Unreal asset to a new name in the same directory and saves it to disk, creating a safety copy before risky edits.
Instructions
Duplicates an asset to a new name in the same directory, then PERSISTS the copy to disk immediately (unless Play-In-Editor is active -- see the "saved"/"save_error" note on the save step below; a duplicate is very often used AS a safety net before a risky edit, so leaving it memory-only defeats the point). By default (remap_internal_refs absent/false) this is otherwise a plain copy: like EditorAssetLibrary.duplicate_asset, any internal references the copy holds still point at the ORIGINAL (not remapped). Set remap_internal_refs=true to run the SAME 2nd-pass reference remap that duplicate_directory uses (FArchiveReplaceObjectRef mapping original->copy) so the copy's own self-references point at the copy, before that save. repoint_parents_within additionally re-applies a MaterialInstance parent via SetParentEditorOnly when the parent maps into the copied set (for a single asset this only fires if the copy's parent is the original itself).
Returns: { original_asset_path: string, new_asset_name: string, new_asset_path: string, duplication_success: bool, duplication_message: string, new_asset_class: string, new_package_name: string, asset_verified: bool, new_file_size_bytes: number?, new_file_size_mb: number?, original_asset_class: string, original_package_name: string, new_path: string?, refs_remapped: int?, saved: bool?, save_error: string? }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| asset_path | Yes | Full asset path to duplicate (e.g. /Game/Assets/MyAsset) | |
| new_asset_name | Yes | Name for the duplicated asset | |
| remap_internal_refs | No | Optional bool (default false). When true, remap the copy's internal refs (original->copy) before the save; adds { new_path, refs_remapped } to the result. | |
| repoint_parents_within | No | Optional bool (default false). When true (and remap_internal_refs true), also re-apply MaterialInstanceConstant parents that map into the copied set via SetParentEditorOnly. |