# SerializationException: 对ScriptableObject 'MyData'的引用已损坏或对象已被销毁

- **ID:** `unity/scriptableobject-serialization-ref`
- **领域:** unity
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

MonoBehaviour或另一个ScriptableObject中的ScriptableObject引用指向了已销毁或缺失的资源，通常是由于资源删除、重新导入或场景卸载导致。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Unity 2021.3 | active | — | — |
| Unity 2022.3 | active | — | — |
| Unity 2023.1 | active | — | — |

## 解决方案

1. ```
   In the Inspector, locate the component with the broken reference and reassign the ScriptableObject asset from the Project window. If the asset is missing, recreate it (e.g., Assets > Create > MyData) and reassign.
   ```
2. ```
   Use a custom Editor script to find and fix broken references: iterate over all serialized properties in the scene and check for missing assets using AssetDatabase.TryGetGUIDAndLocalFileIdentifier.
   ```

## 无效尝试

- **** — Calling Resources.UnloadUnusedAssets() can destroy ScriptableObject references if they are not properly referenced, making the issue worse. (50% 失败率)
- **** — Simply saving the scene does not fix a broken reference; the actual asset must be reassigned. (40% 失败率)
