Search Issue Tracker
Fixed in 2021.3.33f1
Fixed in 2021.3.X, 2022.3.X, 2023.2.X, 2023.3.X, 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
- Too little validation messages in the "WebAssembly Language Features" Memory settings
- Project Settings Search Highlights are misaligned when using the Bitmap Text Rendering Mode
- "GetControlID at event ValidateCommand returns a controlID different from the one in Layout event" Warning is thrown when undoing the deletion of Sprite Shape Profile
- Memory related fields in the "WebAssembly Language Features" can be set to the negative numbers
- "WebAssembly Language Features" Header in the Player Settings has a smaller indentation
Add comment