private static void DoBindProperty(IBindable field, SerializedObjectUpdateWrapper obj, SerializedProperty property) { var fieldElement = field as VisualElement; if (property == null || fieldElement == null) { // Object is null or property was not found, we have to make sure we delete any previous binding RemoveBinding(fieldElement); return; } // This covers the case where a field is being manually bound to a property field.bindingPath = property.propertyPath; if (property != null && fieldElement != null) { using (var evt = SerializedPropertyBindEvent.GetPooled(property)) { if (SendBindingEvent(evt, fieldElement)) { return; } } } CreateBindingObjectForProperty(fieldElement, obj, property); }
private void Reset(SerializedPropertyBindEvent evt) { Clear(); var bindProperty = evt.bindProperty; m_SerializedProperty = bindProperty; if (bindProperty == null) { return; } var handler = ScriptAttributeUtility.GetHandler(m_SerializedProperty); if (handler.hasPropertyDrawer) { var customPropertyGUI = (handler.propertyDrawer as UIElementsPropertyDrawer)?.CreatePropertyGUI(m_SerializedProperty); if (customPropertyGUI == null) { customPropertyGUI = new IMGUIContainer(() => { EditorGUI.BeginChangeCheck(); m_SerializedProperty.serializedObject.Update(); EditorGUILayout.PropertyField(m_SerializedProperty, true); m_SerializedProperty.serializedObject.ApplyModifiedProperties(); EditorGUI.EndChangeCheck(); }); } shadow.Add(customPropertyGUI); } else { var field = CreateFieldFromProperty(bindProperty); if (field != null) { shadow.Add(field); } } }