Search Issue Tracker
Won't Fix
Votes
0
Found in
2021.3.44f1
2022.3.48f1
6000.0.21f1
6000.1.0a7
6000.2.0a1
Issue ID
UUM-82661
Regression
No
Serialization layout error occurs when loading and unloading AssetBundles in a specific sequence
How to reproduce:
1. Open the attached “IN-84251“ project
2. Open the “SampleScene“
3. Enter Play Mode
4. Observe the console window
Expect: "Content: True" is logged twice
Actual: An error, “A scripted object (script unknown or not yet loaded) has a different serialization layout when loading,” is shown, and the second log displays “Content: False”
Reproducible with: 2021.3.44f1, 2022.3.48f1, 6000.0.21f1
Reproduced on: Windows 11
Not reproduced on: No other environment tested
Notes:
The conditions required for this bug to occur are:
Step 1: Load the AssetBundle, load its dependencies, instantiate the prefab, and destroy it
Step 2: Call Resources.UnloadUnusedAssets() twice
Step 3: Unload one of the dependencies by calling AssetBundle.Unload(false) for ScriptableObjectA
Step 4: Call Resources.UnloadUnusedAssets() again.
Step 5: Reload the previously unloaded AssetBundle, instantiate the prefab from Step 1 again
The dependency structure that must be followed is:
Prefab -> ScriptableObjectA -> ScriptableObjectB -> Any Asset (which will be lost).
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
- Unity CIL Linker fails on Player build when persistent listeners have "<" and ">" in their XML attribute names
- ”Lighting data asset ‘LightingData’ is incompatible with the current Unity version…” warnings are thrown when saving Indoors (URP) and Outdoors (URP) Scenes as Scene Templates
- [iOS] The screen blinks when transitioning from custom to Unity splash screen
- [macOS] ”Ignoring depth surface load action as it is memoryless” warnings are thrown when taking Game View Snapshot
- UI Builder Inspector scrolls back up when changes on an expanded but not fully displayed Inspector tab are saved
Resolution Note:
Unloading an asset bundle that serves as a dependency for other asset bundles still in use can lead to undefined behavior. This includes persistent errors that may occur even if the dependency asset bundle is later reloaded. To avoid such issues, ensure that an asset bundle and all asset bundles that depend on it are unloaded together.
we have updated to api docs to clarify the usage.