Search Issue Tracker
By Design
Votes
0
Found in
2022.3.44f1
6000.0.17f1
Issue ID
UUM-79280
Regression
Yes
Prefab loses script-created references when overwritten by the same script
How to reproduce:
1. Open the attached “IN-82791“ project
2. Press “Tools” → “Create Mesh and Prefab” from the Menu Bar to run custom script
3. In the Project window go to “Assets“ → “GeneratedAssets“
4. Select the “PrefabParent“
5. Observe the Inspector window - the “Mesh1” is assigned to ''Mesh”
6. Press “Tools” → “Create Mesh and Prefab”
7. Deselect and select the “PrefabParent“ again
8. Observe the Inspector window
Expected result: the “Mesh1“ is assigned to “Mesh“
Actual result: Mesh is “Missing (mesh)“
Reproducible with: 2022.1.0a7, 2022.3.44f1, 6000.0.17f1
Not reproducible with: 2021.3.43f1, 2022.1.0a6
Reproduced on: Windows 11, macOS 12.6.5 (Intel) (user)
Not reproduced on: No other environment tested
Note: Changing the name of the prefab makes the references appear as expected
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Shader warnings are thrown after building High Definition 3D template
- "EndLayoutGroup: BeginLayoutGroup must be called first" error is thrown when changing Shader Precision Model from the Build Profiles window
- White artifacts/outlines are visible in the Garden Scene when viewing at meshes from a distance
- Shader warnings "Sprite-Unlit-Default" are thrown after building 2D Platrformer Microgame Template
- [Android] HLSL shader becomes corrupted when running on an Android device
Resolution Note:
In this case the user overwrites an asset (Mesh) which gets reimported with a different InstanceID. At the same time the user overwrites a Prefab file with the exact same contents an because of an internal optimization it doesn't get reimported/reloaded. Forcing a reimport/reload when the contents doesn't change in the Prefab system would be a massive performance regression.
The user can force a reimport/reload using our API:
AssetDatabase.ImportAsset("Assets/PrefabParent.prefab", ImportAssetOptions.ForceUpdate | ImportAssetOptions.DontDownloadFromCacheServer);
Please note that all references to the mesh will become invalid until next reload/reimport. For example clicking once on "Tools/Create Mesh and Prefab", assigning the resulting mesh to a scene object and clicking again will make the reference in the scene object become invalid until the scene is reloaded.