Search Issue Tracker
By Design
Votes
0
Found in
2022.1.17f1
2022.2.0b8
2023.1.0a10
Issue ID
UUM-15304
Regression
Yes
Changes made by the Script in the UI Document are reset when performing an Undo operation after changing the GameObject with this Script
How to reproduce:
1. Open the user-attached project “BugReport-UI-Toolkit-Undo”
2. Open the “SampleScene” scene
3. Enter the Play Mode
4. Change the position of the “UIDocument” GameObject
5. Perform Undo operation
6. Observe the text in the Play Mode
Expected result: The first line still says “Updated Text”
Actual result: Undo operation also resets the change made by the Script and the first line says “Initial Text”
Reproducible with: 2022.1.0a12, 2022.1.17f1, 2022.2.0b8, 2023.1.0a10
Not reproducible with: 2021.3.10f1, 2022.1.0a11
Couldn’t test with: 2020.3.40f1 (UI Document can't be loaded due to compiler errors)
Reproducible on: Windows 11 Pro
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
- var VisionOSEDRHeadromm has a comma instead of a dot when building with Metal Rendering App Mode and local OS localization is set to German
- IAP Catalog remove product “x” and add product “+” buttons are not consistent with other remove and add buttons in the Editor
- Performance issues in Play Mode when quickly hovering the mouse cursor over Hierarchy GameObjects
- Frame Debugger displays incorrect output when FidelityFX Super Resolution or Spatial-Temporal Upscaler is used with Temporal Anti-aliasing or Subpixel Morphological Anti-aliasing
- The layout system is failing to correctly calculate or apply the height of the Japanese fallback font when the primary English font's metrics are used
Resolution Note:
This is not something that we can fix. It's how the Undo+Serialization system works in Unity. The system took a snapshot of the UIDocument before entering Play mode. When the script changes the text content (inside UI Toolkit), the system does not know about this change. UI Toolkit elements are not part of the GameObject/MonoBehaviour data. When the user changes the position the GameObject, this action IS recorded. So when you Undo, it simply resets the UIDocument and reloads the UI from UXML, undoing any changes the script made during runtime.