Search Issue Tracker
By Design
By Design in 6000.0.X
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
- “FMOD failed to set the software format to the custom sample rate…” warnings are thrown as System Sample Rate value is being changed in Audio section of Project Settings window
- VFX Marquee selection does match the visual indicator
- “Invalid AABB aabb” errors are spammed when “Infinity” value is entered in Collider Component fields
- Editor Role does not sync with the MPPM Play Mode Scenario Role when entering Play mode
- Long asset names cause overlap with the “Find” function in search result tabs
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}
Resolution Note (6000.0.X):
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}