Search Issue Tracker
Fixed in 2022.2.4f1, 2023.1.0a26
Editor unselects elements when entering and then exiting the Play Mode
# Open the user’s attached project
# In Hierarchy go to Menu > Song Panel Collapsed
# In Inspector scroll down to “Time Between Elements” and change the value of it to 0.16
# Press CTRL + S to save
# Enter the Play Mode
# Exit the Play Mode
# Observe the results
Expected result: “Song Panel Collapsed” Object is still selected in the Hierarchy
Actual result: “Song Panel Collapsed” Object is no more selected
Reproducible with: 2022.1.0b10, 2022.1.17f1, 2023.1.0a1, 2023.1.0a11
Not reproducible with: 2021.3.10f1
Could not test with: 2020.3.40f1,2022.1.0a1 - 2022.1.0b9, 2022.2.0b1, 2022.2.0b8 (NullReferenceException: Object reference not set to an instance of an object
* Using "Enter Play Mode Options" with "Disable Reload Domain", "Disable Reload Scene" and "Disable Scene Backup"
* Reproduction video is in internal notes “Unity Select Issue - 2022 09 02 13 51 27”
* Could not find the first regressed version due to the errors with alpha/beta versions
Jan 03, 2023 15:54
Hi, it happens because we added a new enter playmode optimization that skips saving scene backups, if the scenes are not dirty (unchanged vs. the on disk scene file). however, there are edge cases where we fail to detect the dirty state correctly.
One of these edge cases is with prefab instances, which were not getting fully backed up to disk even though they were dirty. This mistake was causing them to be different when coming back out of playmode, and also causing their selected state to not be properly restored.
Unfortunately, for historical design reasons that we are now somewhat stuck with, this optimization cannot work robustly, so we have decided to remove it.
Dec 19, 2022 12:09
Would it be possible to have a quick explanation about why the "Scene Backup fast enter playmode optimization" (which should just skip saving non dirty scenes) may cause issue like this one? It seems completely unrelated to me but I probably miss something.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- "ArgumentNullException" error in the Console when selecting certain ScriptableObjects and entering Play Mode
- Configurable joints become bouncier when setting "Bounciness" below 1
- Prefabs get corrupted when editing Particle System curves
- Colors on images become darker when enabling "Vertex Color Always in Gamma Color Space"
- Pausing a Visual Effect doesn't pause the “Multiply size over life” effect in the Update Block
Resolution Note (fix version 2023.1.0a26):
Fixed in: 2023.1.0a26