Search Issue Tracker
Fixed in 2020.3.45f1, 2021.3.19f1, 2022.2.6f1, 2023.1.0b3, 2023.2.0a1
[All Ports Landed] Unity Editor crashes on CollectAllSerializeReferenceTypesAndPersistentCallTargets when building a project for Standalone Player [ScriptableObject class/source file mismatch]
1. Open the attached project “Unity Extensions”
2. Build the project
Expected result: Build is successful
Actual result: Unity Editor crashes
Reproducible with: 2021.3.13f1
Couldn't test with: 2020.3.41f1, 2022.1.22f1, 2022.2.0b15, 2023.1.0a18 (Compiler errors: “EditorUserBuildSettings.il2CppCodeGeneration' is obsolete”)
Reproducible on: macOS Catalina 10.15.7 (Intel), Windows 10 (by user)
First few lines of stack trace:
0x00007ff63ca8896a (Unity) CollectAllSerializeReferenceTypesAndPersistentCallTargets
0x00007ff63ca8accd (Unity) CompileGameResourcesFolderDependencies
0x00007ff63d7a284b (Unity) BuildPlayerData
0x00007ff63d7ad007 (Unity) DoBuildPlayer_Build
0x00007ff63d7ab8e6 (Unity) DoBuildPlayer
Summary based on investigation:
The crash is related to two ScriptableObjects where the source file name does not match the class name. The Assets for these ScriptableObjects are stored in a Resources folder so they are included in the build.
When the source file is renamed to match the class name the crash does not occur. Unity shows a warning about the broken state of these objects when the project is opened.
The project may not upgrade smoothly to later versions of Unity, but this bug almost certainly exists in later versions as well. It was also reported with a 2022 project (IN-27866)
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- Some Rigidbody2D.Cast overloads do not correct use the Rigidbody2D angle.
- Same values are being generated if using a random function when “Freeform Light 2D” light is in the scene
- “Unable to use a named GUIStyle without a current skin“ error appears when installing/uninstalling a package if the “Search” window has any text in the search field
- The Animation dropdown in the Animation window can't be opened when Animation is renamed
- [IL2CPP] Building fails when local functions in method with SystemAPI() are used