Search Issue Tracker
By Design
Votes
0
Found in
2022.3.25f1
2023.2.19f1
6000.0.0b15
Issue ID
UUM-70630
Regression
Yes
UI system does not register a MouseDownEvent event when clicking on the Value attributes of the TextField
How to reproduce:
1. Open the “UIToolkitTextField“ project
2. Enter the Play Mode
3. In the Game view click on the “Text Field“ text
4. In the Game view click on the middle of the white rectangle
5. Observe the Console window
Expected result: Two “Triggered“ messages logged to the Console window
Actual result: One “Triggered“ message logged to the Console window
Reproducible with: 2022.3.20f1, 2022.3.25f1, 2023.2.19f1, 6000.0.0b15
Not reproducible with: 2021.3.37f1, 2022.3.19f1
Reproducible on: macOS 13.5.2 (Intel), Windows 10 Pro
Not reproducible on: No other environments tested
Workaround:
1. Open the “Window > UI Toolkit > Debugger“
2. Pick the TextElement in the white rectangle
3. Switch the Picing Mode to Ignore
Notes:
- Clicking on the edges of the white rectangle will log a “Triggered“ message to the Console window
- Reproducible in Player, check the Player.log and search for the “Triggered“ message
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
- NavMesh Surface is baked too high above the ground, making the NavMesh Agents hover above the ground when the HeightMesh is not built
- [Android] Crash on ProcessDynamicBatchGeometryJob with OpenGL or on DrawSharedGeometryJobs with Vulkan
- VFX Graph Memory leak when calling the ClearPropertyBinders and AddRemoveVFXProperty
- Entering "Configure Avatar" inside the Inspector locks it
- [Render Graph Viewer] Resource list icons cropped and in inconsistent positions
Resolution Note:
This is the intended behavior, as designed. The UI Toolkit Runtime behavior now exactly matches the UI Toolkit Editor behavior: mouse events are sent exclusively to the capturing element. In this case, the capture happened during the PointerDownEvent that came right before it, so the MouseDownEvent is sent excusively to the TextElement child of the TextField, which captures the mouse at that time.
There are a few ways to get the GetsTriggered method called in the repro example:
1. use PointerDownEvent instead of MouseDownEvent
{code:c#}private void GetsTriggered(PointerDownEvent ev) { Debug.Log("Triggered"); }
testMouseDownEvent.RegisterCallback<PointerDownEvent>(GetsTriggered);{code}
2. register your callback on the TextElement that has the capture
{code:c#}testMouseDownEvent.Q<VisualElement>("unity-text-input").Q<TextElement>().RegisterCallback<MouseDownEvent>(GetsTriggered);{code}
3. starting from 2023.2, it will also work if you register the MouseDownEvent on the TrickleDown phase
{code:c#}testMouseDownEvent.RegisterCallback<MouseDownEvent>(GetsTriggered, TrickleDown.TrickleDown);{code}