Closed Hellfim closed 1 year ago
Fix should be applied to logic which evaluates VisualElement's children in VisualElementExtensions:
- 27 var itemChildCount = visualElement.childCount;
+ 27 var itemChildCount = visualElement.hierarchy.childCount;
29 for (var i = 0; i < itemChildCount; i++)
30 {
- 31 GetBindableElements(visualElement[i], bindableChilds);
+ 31 GetBindableElements(visualElement.hierarchy[i], bindableChilds);
32 }
- 124 var itemChildCount = visualElement.childCount;
+ 124 var itemChildCount = visualElement.hierarchy.childCount;
126 for (var i = 0; i < itemChildCount; i++)
127 {
- 128 GetBindableElements(visualElement[i], elements);
+ 128 GetBindableElements(visualElement.hierarchy[i], elements);
129 }
Method GetBindableChilds from VisualElementExtensions incorrectly handles cases with bindable elements in templates. Suppose there is an empty scene with 1 GameObject called View and 2 attached components (UI Document and TestCaseView). If one would run such scene and click THE BUTTON he would see a "Normal button pressed" in the console, however if he clicks on a pink background there is no "Background button pressed" in the console. Listing of the files is provided below.
WindowContainer.uxml:
TestCaseWindow.uxml:
TestCaseViewModel.cs:
TestCaseView.cs: