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.CreatePropertyGUI(m_SerializedProperty); if (customPropertyGUI == null) { customPropertyGUI = new IMGUIContainer(() => { var originalWideMode = InspectorElement.SetWideModeForWidth(this); try { EditorGUI.BeginChangeCheck(); m_SerializedProperty.serializedObject.Update(); EditorGUILayout.PropertyField(m_SerializedProperty, true); m_SerializedProperty.serializedObject.ApplyModifiedProperties(); if (EditorGUI.EndChangeCheck()) { DispatchPropertyChangedEvent(); } } finally { EditorGUIUtility.wideMode = originalWideMode; } }); } else { RegisterPropertyChangesOnCustomDrawerElement(customPropertyGUI); } hierarchy.Add(customPropertyGUI); } else { var field = CreateFieldFromProperty(bindProperty); if (field != null) { hierarchy.Add(field); } } }
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.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(); }); } hierarchy.Add(customPropertyGUI); } else { var field = CreateFieldFromProperty(bindProperty); if (field != null) { hierarchy.Add(field); } } }
private void Reset(SerializedPropertyBindEvent evt) { Reset(evt.bindProperty); }