How fani-kiran/unity-assetduplicator works
File structure
• Top-level directory only contains:
• DuplicateFolder.py – the single Python script implementing the full logic
• README.md – usage instructions
• No subdirectories or external modules; all functionality lives in DuplicateFolder.py.
• No build configs, no web front-end, no database—this is purely a file‐system CLI tool.
README for additional insights
• Requirements: Python 3.5+, Mac OS
• Workflow:
1. Copy target folder out of Unity project
2. Clean it of unwanted assets/scripts
3. Run script with “-i FolderName”
4. Script processes .meta files and assets
5. Copy back into Unity for import
• User (CLI) – issues the command in a shell/terminal
• Argument Parser – reads “-i <folder>” flag
• Folder Copier – makes an in‐memory or on‐disk copy of the input folder
• File Scanner – recursively enumerates all files and .meta files in the copied folder
• GUID Updater – for each .meta file, generates a new GUID and replaces references in YAML
• File Writer – writes updated .meta files and any renamed asset files back to disk
• Logger/Console Output – reports progress and errors to the user
• File System – the host OS directories where the script reads and writes
• User → CLI: “python3 DuplicateFolder.py -i MyAssets”
• CLI → Argument Parser: parse input
• Argument Parser → Folder Copier: provide source folder path
• Folder Copier → File System: read assets, write folder copy
• Folder Copier → File Scanner: hand off new folder for processing
• File Scanner → GUID Updater: pass list of .meta files, asset references
• GUID Updater → File Writer: updated content
• File Writer → File System: write updated files back
• File Writer → Logger: success/failure logs
• Logger → User: prints progress
c. Architectural patterns/principles
• Pipeline pattern: data (folder contents) flows through discrete stages (copy → scan → update → write)
• Single Responsibility Principle: each component has one clear job (parsing, copying, scanning, updating, writing)
• CLI utility pattern: no long-lived processes; single invocation, then exit
d. Key technologies
• Python 3.5+ standard library (argparse, os, shutil, uuid, yaml or custom parsing)
• OS File System on macOS
• Unity .meta file format (YAML GUID field)
Elements
• Clear labels for each component/module
– Rectangles for script modules (argument parser, copier, scanner, updater, writer)
• Annotations for key operations (e.g., “generate new GUID,” “replace YAML references,” “write to disk”)