public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { var offset = new Vector2(position.x, position.y); //GUI.BeginGroup(position); { var width = 30f; var margin = 5f; //property.serializedObject.Update(); EditorGUI.PropertyField(new Rect(offset.x, offset.y, position.width - width - margin, position.height), property, label, true); if (GUI.Button(new Rect(position.width - width + offset.x, offset.y, width, position.height), "...") == true) { WindowComponentLibraryChooser.Show((element) => { property.objectReferenceValue = element.mainComponent; property.serializedObject.ApplyModifiedProperties(); }); } //property.serializedObject.ApplyModifiedProperties(); } //GUI.EndGroup(); }
public override void OnPreviewSettings() { base.OnPreviewSettings(); var comp = this.selectedComponent; if (comp != null && comp.tag != LayoutTag.None) { EditorGUIUtility.labelWidth = 100f; comp.component = EditorGUILayout.ObjectField(comp.description.ToLower().UppercaseWords(), comp.component, typeof(WindowComponent), false) as WindowComponent; if (GUILayout.Button("...") == true) { WindowComponentLibraryChooser.Show((element) => { comp.component = element.mainComponent; EditorUtility.SetDirty(comp.component); }); } EditorGUIUtility.LookLikeControls(); } }