Search Issue Tracker
By Design
Votes
0
Found in
2020.3.38f1
2021.3.6f1
2022.1.13f1
2022.2.0b4
2023.1.0a5
Issue ID
UUM-11702
Regression
No
Serialized variable is not updated in the Editor when changing it while the Editor is closed
Reproduction steps:
1. Open the attached ‘TestDidReloadScripts' project
2. Observe the ‘Assets/Editor/Config/EditorConfig.asset’ in the Inspector, note that ‘Value’ is 0
3. Close the Editor
4. Change the 'Value’ in any external text editor
5. Open the project
6. Observe the ‘Assets/Editor/Config/EditorConfig.asset’ in the Inspector
Actual result: ‘Value’ is still 0
Expected result: ‘Value’ is changed
Reproducible with: 2020.3.38f1, 2021.3.6f1, 2022.1.13f1, 2022.1.0b4, 2022.2.0a5
Reproduced on: MacOS 11.6 (Intel)
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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
Resolution Note:
Now, I want to explain why AssetDatabase V2 returns null and ABDV1 does not.
The issue at hand here is consistency. In the scenario you describe, InitializeOnLoadMethod gets called when the editor is booting up. This is analogous to:
1. Modifying a C# script
2. Modifying an asset
3. Calling refresh so both changes are picked up.
So, if we do try that out using ADBV1, in 2018.3, I can show you the biggest problem.
In this case, I have a texture (test_texture.png) and its dimensions are 256x128 pixels
If I:
1. Modify a C# script
2. Change the Dimensions to be something else (i.e. 256x256)
3. Let Auto-Refresh run
You can see that inside the InitalizeOnLoad call, the dimensions get printed and they're not what's on disk!!!
This is because the asset has not been imported yet, and so the last known version of the asset is what ends up getting loaded. This can cause a large number of issues, since you're essentially getting out-of-date data back.
In ADBV2 we make sure to return NULL as a way to tell you that the asset is not available and we know its modified, thus preventing out of date data from being returned until it has been imported.
This is definitely a behaviour change, but for the sake of consistency we chose to do this when ABDV2 was designed.
I have a GIF available here showing what happens: https://forum.unity.com/threads/what-is-asset-database-v2.680170/#post-7638085