Loading...
Loading...
Manages the structured relationship between ScriptableObjects (Data) and Prefabs (Logic/Visuals) in Unity 6. Follows the 'SO-to-Mono' Bridge pattern to ensure instance independence (e.g., individual health for identical robots) while maintaining a clean, data-driven architecture. Use when: (1) Creating new unit/item types, (2) Wiring SO data to Prefab MonoBehaviours, (3) Resolving data-sharing bugs where changing one SO affects all instances.
npx skill4agent add muharremtozan/unity-agent-skills unity-so-prefab-managermaxHealthbaseSpeeddisplayNamecurrentHealthactiveBuffsAwake()[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}");
}mcp_unityMCP_manage_scriptable_object.metaCall manage_scriptable_objectApply Patches.asset.assetAssets/Data/write_to_filemcp_unityMCP_refresh_unity(scope="assets").metam_Script: {fileID: ..., guid: ...}grep_searchreplace_file_content