Search Issue Tracker
By Design
Votes
0
Found in
2020.3.32f1
2021.2.19f1
2021.3.0f1
2022.1.0b15
2022.2.0a10
Issue ID
UUM-3464
Regression
No
PointerUpEvent doesn't work when using left-click on a dragger of the Slider
Reproduction steps:
1. Open users attached project
2. Open Assets > Scenes > SampleScene.unity
3. Enter Play Mode
4. In the Game View left-click and release the dragger of the Slider
5. Observe the Console window
Expected result: "down" and "up" messages are printed in the Console
Actual result: Only the "down" message is printed is in the Console
Reproducible with: 1.0.0-preview.15, 1.0.0-preview.18 (2020.3.32f1), Built-in (2021.2.19f1, 2021.3.0f1, 2022.1.0b15, 2022.2.0a10)
Couldn't test with: 2019.4.38f1 (UI Toolkit not supported)
Note: PointerUpEvent works when using right-click
See: https://unity.slack.com/archives/C3414V4UV/p1656015671717799
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
- Joint Physics result in unexpected behaviors when used for articulated vehicles like buses or trucks
- Standalone Player crashes with "TDerived GetOrLoad<TDerived>() where TDerived : T" when IL2CPP Code generation is set to "Faster (smaller) Builds"
- IndexOutOfRangeException and InvalidOperationException when logging XML string
- Script missing in "Assets/Settings/Mobile_Renderer/GlobalVolumeFeature" of "com.unity.template.urp-blank" template
- “Font Asset Creator - Error Code [Invalid_File_Structure]…“ error is logged when generating Font Assets from fonts which worked with TMP Font Asset Creator
Resolution Note:
This is not necessarily a bug as much as it's a possibly controversial design decision, to make pointer event callbacks only triggered on the capturing element itself and not its parents (even composite root parents) when there's a pointer capture. Exclusive processing by capturing element has been part of UI Toolkit for more than 5 years.
Moreover, there's a relatively easy workaround. You can use
```
slider.Q<VisualElement>("unity-drag-container").RegisterCallback<PointerUpEvent>(e => Debug.Log("Slider dragger PointerUp"));
```
to react to the PointerUpEvent in this situation. You can discover what exact element was receiving the PointerUpEvent by using the UI Toolkit Event Debugger window, in Project Settings -> UI Toolkit -> Enable Event Debugger, then Window -> UI Toolkit -> Event Debugger.
Note that we are changing how pointer events are propagated as part of an event dispatch simplification effort in 2023.2, which include getting rid of the exclusive processing by capturing element, but we don't want to change it in earlier versions such as 2021.3 or 2022.2, or even 2023.1.