protected override void OnRotateToolWindowGUI(CardinalPathWithRotation path) { EditorGUILayout.LabelField("Rotation", EditorStyles.centeredGreyMiniLabel); using (var scope = new ChangeCheckScope(path)) { using (new LabelWidthScope(EditorGUIUtility.singleLineHeight)) { Vector3 eulerAngles = default(Vector3); bool lookTangent = true; eulerAngles = path.GetNodeRatation(selectedNode, Space.Self).eulerAngles; lookTangent = path.IsNodeLookTangent(selectedNode); eulerAngles.x = EditorGUILayout.FloatField("X", eulerAngles.x); eulerAngles.y = EditorGUILayout.FloatField("Y", eulerAngles.y); eulerAngles.z = EditorGUILayout.FloatField("Z", eulerAngles.z); lookTangent = EditorGUIKit.IndentedToggleButton("Look Tangent", lookTangent); if (scope.changed) { path.SetNodeRatation(selectedNode, Quaternion.Euler(eulerAngles), Space.Self); path.SetNodeLookTangent(selectedNode, lookTangent); } } } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { InitializeItemTypes(); using (var check = new ChangeCheckScope()) { int mask = property.FindPropertyRelative("m_Mask").intValue; mask = MaskField(position, label, mask, m_Types.ToArray()); if (check.changed) { property.FindPropertyRelative("m_Mask").intValue = mask; SerializedProperty types = property.FindPropertyRelative("m_Types"); types.ClearArray(); for (int i = 0; i < m_Types.Count; i++) { if ((mask & (1 << i)) != 0) { types.InsertArrayElementAtIndex(types.arraySize); types.GetArrayElementAtIndex(types.arraySize - 1).stringValue = m_Types[i]; } } property.serializedObject.ApplyModifiedProperties(); } } }
protected override void OnMoveToolWindowGUI(T path) { string label = _selectedType == 0 ? "Position" : (_selectedType == 1 ? "Forward Ctrl-point" : "Back Ctrl-point"); EditorGUILayout.LabelField(label, EditorStyles.centeredGreyMiniLabel); using (var scope = new ChangeCheckScope(path)) { Vector3 point; if (_selectedType == -1) { point = path.GetNodeBackControlPoint(selectedNode, Space.Self); } else if (_selectedType == 0) { point = path.GetNodePosition(selectedNode, Space.Self); } else { point = path.GetNodeForwardControlPoint(selectedNode, Space.Self); } using (new LabelWidthScope(EditorGUIUtility.singleLineHeight)) { point.x = EditorGUILayout.FloatField("X", point.x); point.y = EditorGUILayout.FloatField("Y", point.y); point.z = EditorGUILayout.FloatField("Z", point.z); } if (scope.changed) { if (_selectedType == -1) { path.SetNodeBackControlPoint(selectedNode, point, Space.Self); } else if (_selectedType == 0) { path.SetNodePosition(selectedNode, point, Space.Self); } else { path.SetNodeForwardControlPoint(selectedNode, point, Space.Self); } } } using (var scope = new ChangeCheckScope(path)) { using (new LabelWidthScope(EditorGUIUtility.singleLineHeight)) { bool broken = EditorGUIKit.IndentedToggleButton("Broken", path.IsNodeBroken(selectedNode)); if (scope.changed) { path.SetNodeBroken(selectedNode, broken); } } } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); var path = target as CardinalPathWithRotation; using (var scope = new ChangeCheckScope(path)) { bool value = EditorGUIKit.IndentedToggleButton("Preview Rotation", path._previewRotation); if (scope.changed) path._previewRotation = value; } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { var value = (Enum)Enum.ToObject(fieldInfo.FieldType, property.intValue); using (var scope = new ChangeCheckScope(null)) { value = EditorGUI.EnumFlagsField(position, label, value, attribute._includeObsolete); if (scope.changed) { property.intValue = value.GetHashCode(); } } }
public override void OnInspectorGUI() { serializedObject.Update(); EditorGUILayout.PropertyField(_someProp); if (!_someProp.hasMultipleDifferentValues) { } serializedObject.ApplyModifiedProperties(); using (var scope = new ChangeCheckScope(target)) { bool enabled = EditorGUILayout.Toggle("Enabled", target.enabled); if (scope.changed) target.enabled = enabled; } }
public override void OnInspectorGUI() { serializedObject.Update(); EditorGUILayout.PropertyField(_someProp); if (!_someProp.hasMultipleDifferentValues) { } serializedObject.ApplyModifiedProperties(); using (var scope = new ChangeCheckScope(target)) { string name = EditorGUILayout.TextField("Name", target.name); if (scope.changed) target.name = name; } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { if (attribute._quaternion != property.quaternionValue) { property.quaternionValue = attribute._quaternion = property.quaternionValue.normalized; attribute._eulerAngles = attribute._quaternion.eulerAngles; } using (var scope = new ChangeCheckScope(null)) { attribute._eulerAngles = EditorGUI.Vector3Field(position, label, attribute._eulerAngles); if (scope.changed) { property.quaternionValue = attribute._quaternion = Quaternion.Euler(attribute._eulerAngles).normalized; } } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { using (var propScope = new PropertyScope(position, label, property)) using (var changeScope = new ChangeCheckScope()) { var controlPosition = PrefixLabel(position, propScope.content); var floatFieldWidth = Mathf.Min(EditorGUIUtility.fieldWidth, controlPosition.width); var sliderPosition = new Rect(controlPosition) { width = controlPosition.width - floatFieldWidth - SLIDER_SPACING }; const float marker1 = .8f; const float marker2 = .95f; DrawMarkers(sliderPosition, (marker1, new Color(1.00000f, 0.60392f, 0.01961f, MARKER_ALPHA)), (marker2, new Color(1.00000f, 0.25490f, 0.20784f, MARKER_ALPHA))); var newVal = Slider(controlPosition, GUIContent.none, property.floatValue, 0, 1); if (!Event.current.control && !Event.current.alt) { var dist1 = (newVal - marker1) * sliderPosition.width; var dist2 = (newVal - marker2) * sliderPosition.width; if (0 < dist1 && dist1 < 4) { newVal = marker1; } if (0 < dist2 && dist2 < 4) { newVal = marker2; } } if (changeScope.changed) { property.floatValue = newVal; } } }
protected override void OnRotateToolSceneGUI(CardinalPathWithRotation path) { int count = path.nodeCount; for (int i = 0; i < count; i++) { var position = path.GetNodePosition(i); var rotation = path.GetNodeRatation(i); float size = HandleUtility.GetHandleSize(position); Handles.color = new Color(0.6f, 1f, 0.3f); Handles.ArrowHandleCap(0, position, rotation, size, EventType.Repaint); HandlesKit.DrawAALine(position, position + rotation * Vector3.up * size); if (selectedNode == i) { using (var scope = new ChangeCheckScope(path)) { if (path.IsNodeLookTangent(i)) { rotation = Handles.Disc(rotation, position, rotation * Vector3.forward, size, false, 0.01f); } else { rotation = Handles.RotationHandle(rotation, position); } if (scope.changed) { path.SetNodeRatation(i, rotation); } } } else { Handles.color = capNormalColor; if (Handles.Button(position, Quaternion.identity, size * capSize, size * capSize, Handles.DotHandleCap)) { selectedNode = i; } } } }
public override void OnInspectorGUI() { using (ChangeCheckScope check = new ChangeCheckScope()) { DrawPropertiesExcluding(serializedObject, "m_Script", nameof(NetworkSettings.m_PlayerObject)); EditorGUILayout.Space(); EditorGUILayout.LabelField("Objects", EditorStyles.boldLabel); UpdatePlayerObject(); if (check.changed) { serializedObject.ApplyModifiedProperties(); EditorUtility.SetDirty(target); } } }
public override void OnInspectorGUI() { using (new DisabledScope(Application.isPlaying)) { using (var scope = new ChangeCheckScope(target)) { base.OnInspectorGUI(); if (target._poolSettings != null && scope.changed) { for (int i = 0; i < target._poolSettings.Length; i++) { ref var s = ref target._poolSettings[i]; if (string.IsNullOrEmpty(s.name) && s.prefab) { s.name = s.prefab.name; } } } } }
protected override void OnMoveToolWindowGUI(T path) { EditorGUILayout.GetControlRect(false, 0); _showTension = GUILayout.Toggle(_showTension, "Tension-sliders", EditorStyles.miniButton); EditorGUILayout.LabelField("Position", EditorStyles.centeredGreyMiniLabel); using (var scope = new ChangeCheckScope(path)) { Vector3 point = path.GetNodePosition(selectedNode, Space.Self); using (new LabelWidthScope(EditorGUIUtility.singleLineHeight)) { point.x = EditorGUILayout.FloatField("X", point.x); point.y = EditorGUILayout.FloatField("Y", point.y); point.z = EditorGUILayout.FloatField("Z", point.z); } if (scope.changed) { path.SetNodePosition(selectedNode, point, Space.Self); } } }
protected override void OnMoveToolSceneGUI(T path) { int count = path.nodeCount; for (int i = 0; i < count; i++) { // 获取控制点位置 var middle = path.GetNodePosition(i); float capSize; var back = path.GetNodeBackControlPoint(i); var forward = path.GetNodeForwardControlPoint(i); // 绘制切线 Handles.color = selectedNode == i ? new Color(1f, 1f, 1f, 0.9f) : new Color(1f, 1f, 1f, 0.3f); HandlesKit.DrawAALine(back, middle); HandlesKit.DrawAALine(forward, middle); // 绘制后控制点 capSize = HandleUtility.GetHandleSize(back) * FloatingWindow.capSize; if (_selectedType == -1 && selectedNode == i) { using (var scope = new ChangeCheckScope(path)) { Handles.color = capSelectedColor; if (selectedTool == 0) { back = Handles.FreeMoveHandle(back, Quaternion.identity, capSize * 2, snap, Handles.RectangleHandleCap); } else if (selectedTool == 1) { back = Handles.PositionHandle(back, path.transform.rotation); } if (scope.changed) { path.SetNodeBackControlPoint(i, back); } } } else { Handles.color = capNormalColor; if (Handles.Button(back, Quaternion.identity, capSize, capSize, Handles.DotHandleCap)) { selectedNode = i; _selectedType = -1; } } // 绘制前控制点 capSize = HandleUtility.GetHandleSize(forward) * FloatingWindow.capSize; if (_selectedType == 1 && selectedNode == i) { using (var scope = new ChangeCheckScope(path)) { Handles.color = capSelectedColor; if (selectedTool == 0) { forward = Handles.FreeMoveHandle(forward, Quaternion.identity, capSize * 2, snap, Handles.RectangleHandleCap); } else if (selectedTool == 1) { forward = Handles.PositionHandle(forward, path.transform.rotation); } if (scope.changed) { path.SetNodeForwardControlPoint(i, forward); } } } else { Handles.color = capNormalColor; if (Handles.Button(forward, Quaternion.identity, capSize, capSize, Handles.DotHandleCap)) { selectedNode = i; _selectedType = 1; } } // 绘制中控制点 capSize = HandleUtility.GetHandleSize(middle) * FloatingWindow.capSize; if (_selectedType == 0 && selectedNode == i) { using (var scope = new ChangeCheckScope(path)) { Handles.color = capSelectedColor; if (selectedTool == 0) { middle = Handles.FreeMoveHandle(middle, Quaternion.identity, capSize * 2, snap, Handles.RectangleHandleCap); } else if (selectedTool == 1) { middle = Handles.PositionHandle(middle, path.transform.rotation); } if (scope.changed) { path.SetNodePosition(i, middle); } } } else { Handles.color = capNormalColor; if (Handles.Button(middle, Quaternion.identity, capSize, capSize, Handles.DotHandleCap)) { selectedNode = i; _selectedType = 0; } } } }
public override void OnInspectorGUI() { EditorGUILayout.BeginVertical(EditorStyles.helpBox); var rect = EditorGUILayout.GetControlRect(); var rect2 = rect; // controller foldout using (var scope = new ChangeCheckScope(target)) { rect2.width = rect2.height; var result = GUI.Toggle(rect2, target._foldoutController, GUIContent.none, EditorStyles.foldout); if (scope.changed) { target._foldoutController = result; } } // controller label rect.xMin = rect2.xMax; EditorGUI.LabelField(rect, "Controller", EditorStyles.boldLabel); serializedObject.Update(); // controller settings if (target._foldoutController) { EditorGUILayout.PropertyField(_durationProp); EditorGUILayout.PropertyField(_updateModeProp); EditorGUILayout.PropertyField(_timeModeProp); EditorGUILayout.PropertyField(_wrapModeProp); EditorGUILayout.PropertyField(_arrivedActionProp); GUILayout.Space(4); } EditorGUI.DrawRect(EditorGUILayout.GetControlRect(false, 1), EditorStyles.centeredGreyMiniLabel.normal.textColor); GUILayout.Space(4); rect = EditorGUILayout.GetControlRect(); rect2 = rect; // play button rect2.width = EditorGUIUtility.singleLineHeight * 2 - 4; using (new GUIContentColorScope(target.playing ? progressForegroundValid : EditorGUIKit.defaultTextColor)) { target.playing = GUI.Toggle(rect2, target.playing, EditorGUIKit.TempContent(image: EditorAsset.instance.play), imageButtonStyle); } // direction button rect2.x = rect.xMax - rect2.width; using (new DisabledScope(!target.playing)) { using (new GUIContentColorScope(EditorGUIKit.defaultTextColor)) { if (GUI.Button(rect2, EditorGUIKit.TempContent(image: target.direction == PlayDirection.Forward ? EditorAsset.instance.rightArrow : EditorAsset.instance.leftArrow), imageButtonStyle)) { target.ReverseDirection(); } } } rect.xMin += EditorGUIUtility.singleLineHeight * 2; rect.xMax -= EditorGUIUtility.singleLineHeight * 2; // 鼠标开始拖动 if (Event.current.type == EventType.MouseDown) { if (rect.Contains(Event.current.mousePosition)) { target.dragging = true; } } // 鼠标结束拖动 if (Event.current.rawType == EventType.MouseUp) { if (target.dragging) { target.dragging = false; Repaint(); } } // progress bar using (var scope = new ChangeCheckScope(null)) { float progress = EditorGUIKit.ProgressBar(rect, target._normalizedTime, progressBackgroundInvalid, progressForegroundValid); if (scope.changed && target.dragging) { target.normalizedTime = progress; } } GUILayout.Space(4); EditorGUILayout.EndVertical(); GUILayout.Space(4); EditorGUILayout.BeginVertical(EditorStyles.helpBox); rect = EditorGUILayout.GetControlRect(); rect2 = rect; // events foldout using (var scope = new ChangeCheckScope(target)) { rect2.width = rect2.height; var result = GUI.Toggle(rect2, target._foldoutEvents, GUIContent.none, EditorStyles.foldout); if (scope.changed) { target._foldoutEvents = result; } } // events label rect.xMin = rect2.xMax; EditorGUI.LabelField(rect, "Events", EditorStyles.boldLabel); // events if (target._foldoutEvents) { EditorGUILayout.PropertyField(_onForwardArrivedProp); GUILayout.Space(2); EditorGUILayout.PropertyField(_onBackArrivedProp); GUILayout.Space(2); } serializedObject.ApplyModifiedProperties(); EditorGUILayout.EndVertical(); GUILayout.Space(4); EditorGUILayout.BeginVertical(EditorStyles.helpBox); // 绘制 Animation 列表。为了正确处理各种意外情况(比如其他代码增删了列表),因此处理比较复杂 :-/ if (!GeneralKit.IsNullOrEmpty(target._animations)) { int editorIndex = 0; for (int i = 0; i < target._animations.Count; i++) { var anim = target._animations[i]; if (anim) { if (_editors.Count <= editorIndex) { _editors.Add(null); } if (!_editors[editorIndex] || _editors[editorIndex].target != anim) { GeneralKit.DestroySafely(_editors[editorIndex]); _editors[editorIndex] = CreateEditor(anim); } (_editors[editorIndex] as TweenAnimation.Editor).OnInspectorGUI(target); editorIndex++; } else { target._animations.RemoveAt(i--); } } for (; editorIndex < _editors.Count; editorIndex++) { GeneralKit.DestroySafely(_editors[editorIndex]); _editors.RemoveAt(editorIndex--); } } // add button GUILayout.Space(4); var buttonRect = EditorGUILayout.GetControlRect(); if (GUI.Button(buttonRect, "Add Animation...", EditorStyles.miniButton)) { ShowAddMenu(buttonRect); } GUILayout.Space(4); EditorGUILayout.EndVertical(); }
protected override void OnMoveToolSceneGUI(T path) { if (_showTension) { for (int i = 0; i < path.segmentCount; i++) { float tension = path.GetSegmentTension(i); var point1 = path.GetNodePosition(i); var point2 = path.GetNodePosition((i + 1) % path.nodeCount); point1 = point1 * 0.75f + point2 * 0.25f; point2 = point1 / 3f + point2 * (2f / 3f); var point = (point2 - point1) * tension + point1; Handles.color = new Color(1f, 1f, 1f, 0.5f); HandlesKit.DrawAALine(point1, point2, 4); float capSize = HandleUtility.GetHandleSize(point) * FloatingWindow.capSize; using (var scope = new ChangeCheckScope(path)) { Handles.color = capNormalColor; point = Handles.FreeMoveHandle(point, Quaternion.identity, capSize, snap, Handles.CircleHandleCap); tension = MathKit.ClosestPointOnSegmentFactor(point, point1, point2); //tension = (float)Math.Round(tension, 2); //using (new HandlesGUIScope(0)) //{ // var pos2D = HandleUtility.WorldToGUIPoint(point); // var rect = new Rect(pos2D.x + 12, pos2D.y - 9, 32, 18); // EditorGUI.DrawRect(rect, new Color(0, 0, 0, 0.5f)); // using (new GUIContentColorScope(Color.white)) // { // EditorGUI.LabelField(rect, tension.ToString(), EditorStyles.whiteLabel); // } //} if (scope.changed) { path.SetSegmentTension(i, tension); } } } } int count = path.nodeCount; for (int i = 0; i < count; i++) { var position = path.GetNodePosition(i); float capSize = HandleUtility.GetHandleSize(position) * FloatingWindow.capSize; if (selectedNode == i) { using (var scope = new ChangeCheckScope(path)) { Handles.color = capSelectedColor; if (selectedTool == 0) { position = Handles.FreeMoveHandle(position, Quaternion.identity, capSize * 2, snap, Handles.RectangleHandleCap); } else { position = Handles.PositionHandle(position, path.transform.rotation); } if (scope.changed) { path.SetNodePosition(i, position); } } } else { Handles.color = capNormalColor; if (Handles.Button(position, Quaternion.identity, capSize, capSize, Handles.DotHandleCap)) { selectedNode = i; } } } }
public override void OnInspectorGUI() { // Edit Button var rect = EditorGUILayout.GetControlRect(true, 23); rect.x += EditorGUIUtility.labelWidth; rect.width = 33; using (var scope = new ChangeCheckScope(null)) { bool edit = GUI.Toggle(rect, FloatingWindow.target == target, EditorGUIUtility.IconContent("EditCollider"), EditorGUIKit.buttonStyle); rect.x = rect.xMax + 5; rect.width = 140; EditorGUI.LabelField(rect, "Edit Path", EditorGUIKit.middleLeftLabelStyle); if (scope.changed) { FloatingWindow.target = edit ? target : null; } } // circular using (var scope = new ChangeCheckScope(target)) { bool circular = EditorGUILayout.Toggle("Circular", target.circular); if (scope.changed) { target.circular = circular; } } // World Scale using (var scope = new ChangeCheckScope(target)) { float value = EditorGUILayout.FloatField( EditorGUIKit.TempContent("World Scale", null, "Use \"World Scale\" to scale the path instead of scales of transform."), target.worldScale); if (scope.changed) { target.worldScale = value; } } // Length Error using (var scope = new ChangeCheckScope(target)) { float value = EditorGUILayout.FloatField("Length Error", target.lengthError); if (scope.changed) { target.lengthError = value; } } // Length if (target.isSamplesValid) { EditorGUILayout.FloatField("Length", target.length); } else { rect = EditorGUILayout.GetControlRect(); EditorGUI.LabelField(rect, "Length"); rect.xMin += EditorGUIUtility.labelWidth; // Calculate Button if (GUI.Button(rect, "Calculate", EditorStyles.miniButton)) { Undo.RecordObject(target, "Calculate"); target.ValidateSamples(); } } // Visible using (var scope = new ChangeCheckScope(target)) { bool value = EditorGUIKit.IndentedToggleButton("Always Visible", target._alwaysVisible); if (scope.changed) { target._alwaysVisible = value; } } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { if (attribute._label != null) label.text = attribute._label; if (attribute._target == null) { attribute._target = property.serializedObject.targetObject; attribute._propertyInfo = ReflectionKit.GetPropertyInfo(attribute._target, attribute._propertyName); } if (attribute._propertyInfo == null) { EditorGUI.LabelField(position, label.text, "Can't find property"); return; } if (fieldInfo.FieldType != attribute._propertyInfo.PropertyType) { EditorGUI.LabelField(position, label.text, "Mismatching property type"); return; } if (!attribute._propertyInfo.CanRead || !attribute._propertyInfo.CanWrite) { EditorGUI.LabelField(position, label.text, "Property can't read or write"); return; } using (var scope = new ChangeCheckScope(property.serializedObject.targetObject)) { object value = attribute._propertyInfo.GetValue(attribute._target, null); switch (property.propertyType) { case SerializedPropertyType.AnimationCurve: { value = EditorGUI.CurveField(position, label, (AnimationCurve)value); break; } case SerializedPropertyType.Boolean: { value = EditorGUI.Toggle(position, label, (bool)value); break; } case SerializedPropertyType.Bounds: { value = EditorGUI.BoundsField(position, label, (Bounds)value); break; } case SerializedPropertyType.Color: { value = EditorGUI.ColorField(position, label, (Color)value); break; } case SerializedPropertyType.Enum: { value = EditorGUI.EnumPopup(position, label, (System.Enum)value); break; } case SerializedPropertyType.Float: { value = EditorGUI.FloatField(position, label, (float)value); break; } case SerializedPropertyType.Integer: { value = EditorGUI.IntField(position, label, (int)value); break; } case SerializedPropertyType.ObjectReference: { value = EditorGUI.ObjectField(position, label, value as Object, fieldInfo.FieldType, !EditorUtility.IsPersistent(attribute._target)); break; } case SerializedPropertyType.Rect: { value = EditorGUI.RectField(position, label, (Rect)value); break; } case SerializedPropertyType.String: { value = EditorGUI.TextField(position, label, (string)value); break; } case SerializedPropertyType.Vector2: { value = EditorGUI.Vector2Field(position, label, (Vector2)value); break; } case SerializedPropertyType.Vector3: { value = EditorGUI.Vector3Field(position, label, (Vector3)value); break; } case SerializedPropertyType.Vector4: { value = EditorGUI.Vector4Field(position, label.text, (Vector4)value); break; } default: { EditorGUI.LabelField(position, label.text, "Type is not supported"); break; } } if (scope.changed) attribute._propertyInfo.SetValue(attribute._target, value, null); } } // OnGUI
public override void OnInspectorGUI() { m_NameProperty = serializedObject.FindProperty("m_BlueprintName"); m_InputsProperty = serializedObject.FindProperty("m_Inputs"); float lWidth; using (var check = new ChangeCheckScope()) { for (int i = 0; i < m_InputsProperty.arraySize; i++) { SerializedProperty element = m_InputsProperty.GetArrayElementAtIndex(i); SerializedProperty objProperty = element.FindPropertyRelative("m_Item"); SerializedProperty amountProperty = element.FindPropertyRelative("m_RequiredAmount"); EditorGUILayout.BeginHorizontal(EditorStyles.helpBox); amountProperty.intValue = EditorGUILayout.IntField(amountProperty.intValue); lWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 1; EditorGUILayout.LabelField("of"); EditorGUIUtility.labelWidth = lWidth; objProperty.objectReferenceValue = EditorGUILayout.ObjectField(objProperty.objectReferenceValue, typeof(InventoryItem), false); if (GUILayout.Button(EditorGUIUtility.IconContent("d_TreeEditor.Trash"), GUIStyle.none)) { m_InputsProperty.DeleteArrayElementAtIndex(i); break; } EditorGUILayout.EndVertical(); if (i != m_InputsProperty.arraySize - 1) { EditorGUILayout.LabelField("+"); } } if (GUILayout.Button("Add", EditorStyles.miniButton)) { m_InputsProperty.InsertArrayElementAtIndex(m_InputsProperty.arraySize); } EditorGUILayout.LabelField("="); EditorGUILayout.BeginVertical(EditorStyles.helpBox); lWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 70; SerializedProperty outputProp = serializedObject.FindProperty("m_Output"); outputProp.objectReferenceValue = EditorGUILayout.ObjectField("1 of", outputProp.objectReferenceValue, typeof(InventoryItem), false); EditorGUIUtility.labelWidth = lWidth; EditorGUILayout.EndVertical(); EditorGUILayout.Space(); if (check.changed) { serializedObject.ApplyModifiedProperties(); } } }