Search Issue Tracker
By Design
Votes
33
Found in
2020.3.39f1
2021.3.8f1
2022.1.14f1
2022.2.0b6
2023.1.0a8
2023.2.0a1
Issue ID
UUM-12454
Regression
No
Serialized field values are lost when switching between branches using Git
Reproduction steps:
# Open the attached project
# Open the “/Assets/Scenes/SampleScene.unity” Scene
# Select the “MyData” GameObject in the Hierarchy window
# Checkout the “develop” branch in Git
# Observe the Serialized “My Behavior” Script fields in the Inspector window
# Checkout the “remove-mybehavior-field” branch in Git
# Observe the Serialized “My Behavior” Script fields in the Inspector window
# Checkout the “develop” branch in Git
# Observe the Serialized “My Behavior” Script fields in the Inspector window
Expected result: Serialized field contains MyData Asset
Actual result: Serialized field is empty
Reproducible with: 2020.3.39f1, 2021.3.8f1, 2022.1.14f1, 2022.2.0b6, 2023.1.0a8
Reproducible on: Windows 10 (21H2)
Notes:
* Reloading the Scene fixes the issue when the GameObject in the Scene is affected, however, if a ScriptableObject is affected, only “Reimport All” or Editor restart fixes the issue
* The Editor has to be open when switching to another branch and the Editor has to recompile once a new branch has been loaded
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
- Sprite Atlas remains loaded in memory after scene change or unloading assets
- Decompressing a DeflateStream under IL2CPP misses a few bytes
- Referred style sheet stays dirty after saving when using the UIBuilder
- The Height map Amplitude is not working when using HDRP/LayeredLit
- Infinite inertial tensor rotation values are not discarded (both AB and RB)
Resolution Note:
Hi, we do recognize this can be a troublesome issue, but it is not a new issues, it has been there even since Mono and Domain reloads were introduced. A simple way to reproduce it is the following:
1. You have a script with public field and it has some value (stored in the scene file).
2. You comment out this field. After domain reload it is gone (value is still in the scene file of course).
3. You un-comment it back. After the domain reload the field has default value (the actual value is still in the scene file and "come back" after scene reload).
The reason this has not been fixed is because it would be a massive iteration slow down. Basically we would have to reload EVERYTHING when you make changes to a script and that is simply not acceptable in the most common case.
We know this is not great, but the recommendation is to close the editor when switching branches in version control or at least but have any scenes open, though that will not handle the ScriptableObject asset case.