Search Issue Tracker
Won't Fix
Votes
0
Found in
2021.3.27f1
2022.3.2f1
2023.1.0f1
2023.2.0a19
Issue ID
UUM-40066
Regression
No
EditorGUI.EndChangeCheck is not triggered when dragging an Object onto an empty array in the Inspector window
How to reproduce:
1. Open the attached project "EndChangeCheckTest.zip"
2. Select "GameObject with SomeComponent" in the Hierarchy window
3. Drag and drop "Main Camera" from the Hierarchy window onto "My Array" in the Inspector window
Expected results: "Changed!" is logged in the Console window
Actual results: "Changed!" is not logged in the Console window
Reproducible with: 2021.3.27f1, 2022.3.2f1, 2023.1.0f1, 2023.2.0a19
Reproducible on: Windows 10
-
jasonnk
May 15, 2024 14:05
I've just hit this in 2022.3.21 and I don't understand why this won't be fixed or at least documented. (for Users who come across this, there are 2 possible workarounds outlined below)
I'm using `EditorGUILayout.PropertyField(...)` as the UI control:
# Workaround 1
A very basic workaround is to manually check `SerializedObject.hasModifiedProperties` alongside `EditorGUI.EndChangeCheck()` to capture the drag-drop being applied.From expiermentation I've noticed that `hasModifiedProperties` only gets set when the drag-drop completes inside the `EditorGUILayout.PropertyField(...)` so from my ivory tower view it _should_ be a pretty forward case of also setting whatever internal change flag you've got at that point too.
If this is definitely not going to be fixed then there seriously needs to be a review of the documentation of `SerialisedProperty` and `Begin/EndChangeCheck()` to inform users of the cases where it will *not* trigger. This feels like a relatively common use-case.
I've also noticed that using the context menu on the Array property (to delete or duplicate elements) does not trigger change check reports and doesn't set `hasModifiedProperties` either.
# Workaround 2
To workaround _that_ I have to manually check `SerializedProperty.contentHash` across `OnInspectorGUI()` calls and manually set `GUI.changed = true;` so that the code doesn't have to become more polluted than it already has become.
This will also detect the intial Drag-Drop failure.
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
- UI Overlay Image gets darker on each Camera when multiple Cameras are used
- Assertion failed on expression: 'scriptedImporterClass == SCRIPTING_NULL error when opening the standalone profiler window
- Disabled assets in Import Unity Package window aren't tracked but count as being selected by user
- [Windows] Crash on GetManagerFromContext when video is playing and creating High Definition 3D Projects after FMOD failed to switch back to normal output Error appeared
- GC Alloc produced when adding items to MultiColumnListView with Auto Assign Binding
Resolution Note:
Thank you for bringing this issue to our attention. After careful consideration, we have determined that this issue is not aligned with our current development priorities and focus areas. As such, we have decided not to invest time and resources into addressing it. We appreciate your input and understanding, and please let us know if you have any other concerns or issues you would like to report in the future.