Search Issue Tracker
By Design
By Design in 6000.4.X
Votes
0
Found in
6000.0.59f1
6000.2.8f1
6000.3.0b6
6000.4.0a3
Issue ID
UUM-122358
Regression
No
[UI Toolkit] Missing documentation about RegisterValueChangedCallback being fired on entering Play Mode for Values using SerializedObject data binding
Steps to reproduce:
- Open the attached project
- Open the TestScene
- Observe the Game view: in-game UI displays a text field with a value "test", which is bound to the BasicSO scriptable object
- Select the BasicSO object in the Project view and verify that the values match
- Enter Play Mode
- Observe the Console window
Actual results: Despite no visual changes occurring, ValueChangedCallback is triggered. This behaviour is not documented
Expected results: Data binding sections mention ValueChangedCallback being triggered on entering Play Mode when using Two-Way or To-Target bindings
Reproducible with versions: 6000.0.59f1, 6000.2.8f1, 6000.3.0b6, 6000.4.0a3
Tested on (OS): macOS 26.0.1
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
- Texture Import Warnings are obscured by other Terrain Layer options in the Inspector
- Active Targets section text in Graph Inspector is truncated despite available space
- Burst Inspector middle divider is jittering when resized with the Burst Inspector window docked
- Shader Graph Node information is briefly displayed in Graph Inspector when clicking on Category in the Blackboard
- JsonConvert conversion fails trying to call GetCallbackMethodsForType when [OnDeserialized] is used in a class
Resolution Note:
When entering play mode, the UI will be regenerated. Since the target TextField in the UXML file did not set a value, it will use the default one, which is an empty string.
When the binding is applied, it will set the value coming from the data source and if it is different, it will fire the value changed callback. This is all expected.
So although there might not be a visual change occurring, a change has indeed occurred.
As a side note, OnEnable/OnDisable should be prioritized to query elements and perform configuration. This is because the UIDocument will generate the UI on OnEnable and release it on OnDisable.
Resolution Note (6000.4.X):
When entering play mode, the UI will be regenerated. Since the target TextField in the UXML file did not set a value, it will use the default one, which is an empty string.
When the binding is applied, it will set the value coming from the data source and if it is different, it will fire the value changed callback. This is all expected.
So although there might not be a visual change occurring, a change has indeed occurred.
As a side note, OnEnable/OnDisable should be prioritized to query elements and perform configuration. This is because the UIDocument will generate the UI on OnEnable and release it on OnDisable.