Search Issue Tracker

By Design

Votes

0

Found in

6000.0.54f1

6000.1.13f1

6000.2.0b11

6000.3.0a3

Issue ID

UUM-112293

Regression

No

Editor freezes and "Recursively dispatching event" errors appear in the Console when setting DropdownField label in ValueChangedCallback

-

How to reproduce:
1. Open the attached “IN-109095” project
2. Open the “SampleScene” Scene
3. Enter Play mode
4. In the Game view open the dropdown list and select “Any”
5. Observe the Editor and the Console window

Expected result: The Editor does not freeze and the Console contains no errors
Actual result: The Editor freezes for ~30-60 seconds and the Console contains hundreds of “Recursively dispatching event” errors

Reproducible with: 2023.1.0a1, 6000.0.54f1, 6000.1.13f1, 6000.2.0b11, 6000.3.0a3

Reproduced on: Windows 10 (User), Windows 11
Not reproduced on: No other environment tested

Note: Different error appears in older versions

  1. Resolution Note:

    When you use RegisterValueChangedCallback, it registers a ChangeEvent<string> on the target object. A common misconception is that this event will only be triggered when the specific element it is registered to changes. However, this is not the case. Any ChangeEvent<string> that propagates through this element will trigger the callback.

    In this case, when you modify the label with the DropDown value, the Label element itself dispatches a ChangeEvent<string>, which then triggers your callback. You then change the label again, which triggers another callback, causing the recursion. This behavior can be managed by checking the target property in the event to ensure that the event originates from the element you care about.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.