Search Issue Tracker
Fixed
Fixed in 2021.3.33f1, 2022.3.14f1, 2023.2.0b18, 2023.3.0a13
Votes
10
Found in
2021.3.30f1
2022.3.9f1
2023.1.12f1
2023.2.0b9
2023.3.0a5
Issue ID
UUM-48662
Regression
No
ScriptableObject serialization for Runtime build mismatch when assembly definition updated
Crucial: The issue is NOT related to `#if UNITY_EDITOR` and is fundamental issue relating to ScriptableObject runtime serialisation as of 2023.3.0a11 trunk, the error message is potentially lead to this assumption therefore -the summary needs updating in due course.- Done
Steps to reproduce:
1. Before opening the project, open the "log.txt" file attached and note the errors related to serialization and #ifdef UNITY_EDITOR
2. Open the attached user's project "SerializationErrorRepro.zip"
3. Build the Standalone Player and run it
4. Check the player the log file and note that there are no serialization errors
5. In the project's "Scripts/Runtime/" folder, delete the Assembly Definition file named "Game"
6. Add a new Assembly Definition file in the project's Scripts/Runtime/ folder and name it whatever you want (for example, "Game1")
7. Once the project compiles, build the Standalone Player
8. Run the build, and in the Player log file, note that the serialization errors are occurring
Expected results: ScriptableObject serialization for in-editor-only field does not break in build when adding assembly definitions
Actual results: ScriptableObject serialization for in-editor-only field breaks in build when adding assembly definitions
Reproducible with: 2021.3.30f1, 2022.3.9f1, 2023.1.12f1, 2023.2.0b9, 2023.3.0a5
Reproducible on: Windows 11
Not reproducible on: No other environment tested
Notes:
-If a subclass of ScriptableObject is moved into or to another assembly definition after the Unity Library folder has been established, the serialization of instances of that ScriptableObject will break in a build if they contain editor-only fields (serialized fields wrapped by #if UNITY_EDITOR).
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- SystemInfo.get_graphicsDeviceName() is generating garbage GC Alloc when using Metal graphics API
- Crash on D3D12CommonShader::ApplyGpuProgram when attaching material which samples "_UnityFBInput0" to "Full Screen Pass Renderer Feature" Component
- SpeedTree meshes and objects count differs when comparing the numbers in the Player with the Editor
- Model and Prefab Preview icons are not updated after upgrading associated Materials to URP
- Game view is rendered white when viewing the Editor with HDR display and Post Proccesing is enabled on the Main Camera with 2D URP
Add comment