Search Issue Tracker
Won't Fix
Votes
0
Found in
2020.3.35f1
2021.3.3f1
2022.1.3f1
2022.2.0a13
Issue ID
UUM-664
Regression
No
Crash on IterateTypeTree<BackupState::FileToMemoryID> when attempting to load an AssetBundle
How to reproduce:
1. Open the attached project from "crash.zip"
2. Toggle "Maximize on Play" in Game View and enter Play Mode
3. Click the "Button" button in Game View (might be hidden in the bottom left corner)
Reproducible with: 2020.3.31f1, 2021.2.16f1, 2022.1.0b12, 2022.2.0a8
Couldn't test with: 2019.4.31f1 (The AssetBundle can't be loaded because it was not built with the right version or build target.)
First lines of stack trace:
0x00007ff67c247f87 (Unity) IterateTypeTree<BackupState::FileToMemoryID>
0x00007ff67c271591 (Unity) SerializableManagedRefBackupGenerator::TransferBackup
0x00007ff67c2525c4 (Unity) MonoBehaviour::Transfer<SafeBinaryRead>
0x00007ff67c273754 (Unity) MonoBehaviour::VirtualRedirectTransfer
0x00007ff67c3431b3 (Unity) SerializedFile::ReadObject
0x00007ff67c328022 (Unity) PersistentManager::ReadAndActivateObjectThreaded
Note: The bundle was generated with "BundleGenerator.cs" in the project's directory
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
- "HideFlags.HideAndDontSave" flag does not work when the Components are added in OnEnable and Awake methods
- Graph VFX not compiling enterely until they are open on MACOS
- Longer component titles exceed the window's display boundaries
- Overlapping objects do not collide when setting Physics.IgnoreCollision to false
- Crash on RaiseException when deleting animation transitions in a specific Animation Controller
Resolution Note:
Unfortunately we are unable to reproduce the root cause given the provided project.
The AssetBundle that crashes has invalid type info - rather than having the player definition it seems to have the type definition for the class as it compiles in the editor. This crashes because when loading it tries to deserialize this field:
MonoBehaviour Base -> ObscuredFloat attackSpeed -> migratedVersion string which is defined only withing #if UNITY_EDITOR conditional defines.
The object is correctly serialized without that editor only fiield. But with the wrong type info Unity attempts to read a string at that position in the binary data.
As mentioned in the original bug report a freshly built AssetBundle loads properly, it has the correct class definition. Confirmed with 2021.3. So we do not know the steps to create an AssetBundle with this mismatch of type and serialized data.
Sorry also for the delay in investigation - I am hoping that you have already found a workaround. Otherwise perhaps this info about what caused the crash might aid in both finding ways to avoid it in your project. If you can narrowing down more of a repro case that we can use to create the broken AssetBundles then we could investigate further to try to fix any lingering bug.
Note: it is possible this is a symptom of a bug that is already fixed in Unity.