private bool ObjectReferenceGUI(Rect rect) { var obj = ObjectRef.Obj; if (ObjectRef.HasReferenceObject()) { var objectRect = rect; objectRect.width = IsEdit ? objectRect.width - 70f : objectRect.width; objectRect.y += EditorGUIUtility.standardVerticalSpacing + rect.height; objectRect.height = EditorGUIUtility.singleLineHeight; if (obj != null) { //Undo.IncrementCurrentGroup(); //UndoHelper.EditorMemoUndo( UndoHelper.UNDO_MEMO_EDIT ); ObjectRef.Obj = EditorGUI.ObjectField(objectRect, ObjectRef.Obj, typeof(Object), true); } else { var buttonWidth = EditorStyles.objectField.CalcSize(new GUIContent(ObjectRef.SceneMemo.ObjectName)); objectRect.width = buttonWidth.x; if (GUI.Button(objectRect, ObjectRef.SceneMemo.ObjectName, EditorStyles.objectField)) { UnitySceneMemoHelper.PopupWindowContent.Initialize(ObjectRef.SceneMemo); PopupWindow.Show(rect, UnitySceneMemoHelper.PopupWindowContent); } var textureRect = objectRect; textureRect.xMin += buttonWidth.x; drawComponent(textureRect, ObjectRef.SceneMemo.Components); } if (IsEdit) { var buttonRect = objectRect; buttonRect.x = objectRect.xMax; buttonRect.width = 70f; if (GUI.Button(buttonRect, "clear")) { UndoHelper.EditorMemoUndo(UndoHelper.UNDO_MEMO_EDIT); ObjectRef.Obj = null; ObjectRef.ScenePath = null; ObjectRef.SceneMemo = null; ObjectRef.LocalIdentifierInFile = 0; GUIUtility.keyboardControl = 0; } } return(true); } else { return(false); } }