About unity-so-prefab-manager
A Unity skill for structuring ScriptableObject templates and Prefab instances with a Bridge pattern. It also describes API- and YAML-based asset creation and direct GUID auditing and repair.
Key features
- 01Separate template data from runtime state
- 02Initialize instance values in Awake
- 03Create assets through the Unity API
- 04Generate assets in bulk with YAML
- 05Inspect and repair GUID references
Use cases
- 01Share templates across units with separate health values
- 02Create a small or large set of ScriptableObjects
- 03Check script GUIDs attached to Prefabs
- 04Repair broken references across a project
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ muharremtozan/ unity-agent-skills --skill unity-so-prefab-managerAfter installing, type/unity-so-prefab-managerin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
references/bridge-pattern.mdnaming-conventions.mdyaml-templates.mdunity-so-prefab-manager/assets/code/DataEntity.cs.txtunity-so-prefab-manager/references/bridge-pattern.mdnaming-conventions.mdyaml-templates.mdDetails
From the project READMEUnity SO-Prefab Manager
This skill enforces a strictly modular "Bridge" pattern between Data and Logic.
Core Workflow: The Bridge Pattern
To ensure that multiple instances of the same unit (e.g., 4 Robots) can have independent runtime values (Health, Energy) while sharing the same Template (RobotSO), follow these steps:
1. Structure the ScriptableObject (The Template)
The SO should contain Static/Read-Only data that defines the "Ideal" version of the object.
- Example:
maxHealth,baseSpeed,displayName.
2. Structure the MonoBehaviour (The Instance)
The script on the Prefab should contain Runtime/Mutable data and a reference to the SO.
- Example:
currentHealth,activeBuffs.
3. Initialize the Bridge
Use Awake() to copy values from the SO to the local instance variables.
[Header("Data Reference")]
[SerializeField] private RobotSO data;
[Header("Runtime State")]
private float currentHealth;
private void Awake() {
if (data == null) {
Debug.LogError($"[System] Fail: Missing SO data on {gameObject.name}");
return;
}
// Initialize independent state
currentHealth = data.MaxHealth;
Debug.Log($"[{data.name}] Success: Initialized instance | Health: {currentHealth}");
}
Advanced Usage
1. File Creation: API-First vs. YAML Power-Mode
Standard (1-10 Files) - Use Unity API
For most tasks, use mcp_unityMCP_manage_scriptable_object. This is the healthiest method as it ensures GUID integrity and immediate .meta file availability.
- Workflow:
Call manage_scriptable_object->Apply Patches.
Performance (10+ Files) - Use YAML Generation
For massive data dumps (e.g., importing 50 items), bypass the API latency by writing files directly.
- Workflow:
- Create a YAML template based on an existing
.assetfile. - Write
.assetfiles directly toAssets/Data/viawrite_to_file. - Call
mcp_unityMCP_refresh_unity(scope="assets")to force Unity to generate.metafiles.
- Create a YAML template based on an existing
2. Surgical YAML (Deep Debugging)
Use direct file reading/parsing for "Deep Audits" that the API can't quickly handle:
- GUID Verification: Search for a specific
m_Script: {fileID: ..., guid: ...}in prefabs to find which scripts are actually attached. - Reference Repair: Use
grep_searchandreplace_file_contentproject-wide to swap broken GUIDs without opening the Editor for every file.
Reference Material
- See references/bridge-pattern.md for detailed implementation details and troubleshooting.
- See references/naming-conventions.md for the project-standard folder structure.
- See references/yaml-templates.md for standard Unity YAML boilerplate.