Search Issue Tracker
By Design
Votes
0
Found in
2022.3.8f1
2023.1.10f1
2023.2.0b6
2023.3.0a2
Issue ID
UUM-46857
Regression
No
RegisterValueChangedCallback raised for parent element when it is raised for child if they both use it
Reproduction steps:
1. Open the attached project "Bug-INotifyValueChanged"
2. Click "Tests/INotifyValueChanged Bug Window" in the menu bar
3. Expand the "Foldout" in the TestWindow
4. Click the "Value" checkbox in the TestWindow
Expected result: The Console logs "Foldout 'ValueChanged' raised with value: True" and "Toggle 'ValueChanged' raised with value: True"
Actual result: The Console logs: "Foldout 'ValueChanged' raised with value: True", "Toggle 'ValueChanged' raised with value: True" and "Foldout 'ValueChanged' raised with value: True"
Reproducible with: 2021.3.29f1, 2022.3.8f1, 2023.1.10f1, 2023.2.0b6, 2023.3.0a2
Reproducible on: macOS 13.4.1 (Intel), Windows 10 (user’s)
Not reproducible on: No other environment tested
Note: not reproducible if not using RegisterValueChangedCallback with the "Foldout" - comment lines 23-28 of TestWindow.cs
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
- Job scheduling with batching is slow with dependencies and worker threads have poor utilization
- [HDRP] HDAdditionalLightData.RequestSubShadowMapRendering on directional lights breaks cascade shadows rendering
- Memory leaks when Instantiating Objects with SerializeReference
- Currently selected Action Map switches to the first Action Map in the list and it's first Action when editing the Binding Path of a newly created Action
- "F" default focusing Unity shortcut zooms out when the first time focusing the GameObject
Resolution Note:
As can be seen on the Unity Manual, the ChangeEvent event bubbles and trickles down, so it will reach parent elements after the child element:
https://docs.unity3d.com/Manual/UIE-Change-Events.html
You can add `evt.StopPropagation()` at the end of the Toggle callback to stop it from reaching the parent and obtain the expected behavior.