Search Issue Tracker

By Design

Votes

0

Found in

2022.3.33f1

6000.0.7f1

Issue ID

UUM-74679

Regression

Yes

PropertyField with range attribute triggers change event when the value didn't change

--

-

Reproduction steps:
1. Open the attached “BugRepro” project
2. In the Editor, navigate to Test > My Editor Window
3. Observe the Console window

Expected result: The change callback is called when the value is changed in the UI
Actual result: The change callback for the property with the Range attribute is called upon field creation even though the value didn't change.

Reproducible with: 2022.1.0a13, 2022.3.33f1, 6000.0.7f1
Not reproducible with: 2021.3.39f1, 2022.1.0a12

Reproducible on: Windows 11
Not reproducible on: No other environment tested

  1. Resolution Note:

    The Bind operation to the SerializedObject is done automatically, but is executed after the CreateGUI call, to allow users to create their UI fully before we bind it.

    Binding a SerializedProperty to a field will always trigger a value change event, because the value is now coming from the serialized data and we need to inform users that this as changed, even if the value is the same. As a result, this value change after initialization of PropertyFields is expected. Still, we are planning to improve this in future versions.

    A workaround to skip it is to schedule the registration to the next update like so: myPropertyField.schedule.Execute(/* registration */);

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.