protected override void DrawRaiseButton() { SerializedProperty property = serializedObject.FindProperty("_debugValue"); // Remove _debugValue when it is non serializable classes (interfaces, abstract classes) if (property != null) { using (var scope = new EditorGUI.ChangeCheckScope()) { Type debugValueType = GetDebugValueType(property); if (!debugValueType.IsSubclassOf(typeof(UnityEngine.Object))) { return; } GenericPropertyDrawer.DrawPropertyDrawerLayout(property, debugValueType); if (scope.changed) { serializedObject.ApplyModifiedProperties(); } } if (GUILayout.Button("Raise")) { CallMethod(GetDebugValue(property)); } } }
/// <summary> /// Return the height of the item in the <see cref="ReorderableList"/> that is being drawn. /// </summary> /// <param name="index">The index of the item in the list being drawn.</param> /// <returns></returns> private float GetElementHeight(int index) { var indexedItemProperty = CollectionItemsProperty.GetArrayElementAtIndex(index); return(GenericPropertyDrawer.IsSingleLineGUIType(Target.Type) ? EditorGUIUtility.singleLineHeight : EditorGUI.GetPropertyHeight(indexedItemProperty)); }
private void DrawElement(Rect rect, int index, bool isActive, bool isFocused) { SerializedProperty property = CollectionItemsProperty.GetArrayElementAtIndex(index); EditorGUI.BeginDisabledGroup(DISABLE_ELEMENTS); GenericPropertyDrawer.DrawPropertyDrawer(rect, Target.Type, property, _noPropertyDrawerWarningGUIContent); EditorGUI.EndDisabledGroup(); }
private void DrawElement(Rect rect, int index, bool isActive, bool isFocused) { rect = SOArchitecture_EditorUtility.GetReorderableListElementFieldRect(rect); SerializedProperty property = CollectionItemsProperty.GetArrayElementAtIndex(index); EditorGUI.BeginDisabledGroup(DISABLE_ELEMENTS); GenericPropertyDrawer.DrawPropertyDrawer(rect, new GUIContent("Element " + index), Target.Type, property, _noPropertyDrawerWarningGUIContent); EditorGUI.EndDisabledGroup(); }
protected virtual void DrawValue() { using (var scope = new EditorGUI.ChangeCheckScope()) { string content = "Cannot display value. No PropertyDrawer for (" + Target.Type + ") [" + Target.ToString() + "]"; GenericPropertyDrawer.DrawPropertyDrawerLayout(Target.Type, new GUIContent("Value"), _valueProperty, new GUIContent(content, content)); GenericPropertyDrawer.DrawPropertyDrawerLayout(Target.Type, new GUIContent("Default Value"), _defaultValueProperty, new GUIContent(content, content)); if (scope.changed) { // Value changed, raise events Target.Raise(); } } }
private void DrawGenericPropertyField(Rect valueRect) { if (ValueType != null) { GenericPropertyDrawer.DrawPropertyDrawer(valueRect, GUIContent.none, ValueType, constantValue, GUIContent.none); } else { Debug.LogWarningFormat( property.objectReferenceValue, COULD_NOT_FIND_VALUE_FIELD_WARNING_FORMAT, CONSTANT_VALUE_PROPERTY_NAME, ValueType); } }
protected virtual void DrawValue() { using (var scope = new EditorGUI.ChangeCheckScope()) { string content = "Cannot display value. No PropertyDrawer for (" + Target.Type + ") [" + Target.ToString() + "]"; GenericPropertyDrawer.DrawPropertyDrawerLayout(_valueProperty, Target.Type); if (scope.changed) { serializedObject.ApplyModifiedProperties(); // Value changed, raise events Target.Raise(); } } }
protected virtual void DrawValue() { GenericPropertyDrawer.DrawPropertyDrawerLayout(_valueProperty, Target.Type); EditorGUILayout.PropertyField(_useDefaultProperty); _useDefaultValueAnimation.target = _useDefaultProperty.boolValue; using (var anim = new EditorGUILayout.FadeGroupScope(_useDefaultValueAnimation.faded)) { if (anim.visible) { using (new EditorGUI.IndentLevelScope()) { GenericPropertyDrawer.DrawPropertyDrawerLayout(_defaultValueProperty, Target.ReferenceType); } } } }
private void DrawGenericPropertyField(Rect position, Rect valueRect) { if (IsConstantValueMultiline(constantValue)) { using (new EditorGUI.IndentLevelScope()) { position.y += EditorGUIUtility.singleLineHeight; position.height = GenericPropertyDrawer.GetHeight(constantValue, ValueType); GenericPropertyDrawer.DrawPropertyDrawer(position, constantValue, ValueType); } } else { GenericPropertyDrawer.DrawPropertyDrawer(valueRect, constantValue, ValueType, false); } }
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { SerializedProperty useConstant = property.FindPropertyRelative(USE_CONSTANT_VALUE_PROPERTY_NAME); SerializedProperty constantValue = property.FindPropertyRelative(CONSTANT_VALUE_PROPERTY_NAME); if (useConstant.boolValue) { if (IsConstantValueMultiline(constantValue)) { return(GenericPropertyDrawer.GetHeight(constantValue, ValueType) + EditorGUIUtility.singleLineHeight); } else { return(EditorGUIUtility.singleLineHeight); } } return(EditorGUIUtility.singleLineHeight); }
protected override void DrawRaiseButton() { SerializedProperty property = serializedObject.FindProperty("_debugValue"); using (var scope = new EditorGUI.ChangeCheckScope()) { Type debugValueType = GetDebugValueType(property); GenericPropertyDrawer.DrawPropertyDrawerLayout(property, debugValueType); if (scope.changed) { serializedObject.ApplyModifiedProperties(); } } if (GUILayout.Button("Raise")) { CallMethod(GetDebugValue(property)); } }
protected virtual void DrawValue() { using (var scope = new EditorGUI.ChangeCheckScope()) { // If clamped and we can draw better clamp controls for this variable's type, do so. Otherwise default to showing // the default property drawer for that type. if (_isClamped.boolValue && ClampValueHelper.CanDrawClampRange(_valueProperty)) { ClampValueHelper.DrawClampRangeLayout(_valueProperty, _minValueProperty, _maxValueProperty); } else { GenericPropertyDrawer.DrawPropertyDrawerLayout(_valueProperty, Target.Type); } if (scope.changed) { serializedObject.ApplyModifiedProperties(); // Value changed, raise events Target.Raise(); } } }
protected virtual void DrawValue() { GenericPropertyDrawer.DrawPropertyDrawerLayout(_valueProperty, Target.Type); }
private float GetHeight(int index) { SerializedProperty property = CollectionItemsProperty.GetArrayElementAtIndex(index); return(GenericPropertyDrawer.GetHeight(property, Target.Type) + EditorGUIUtility.standardVerticalSpacing); }
private bool IsConstantValueMultiline(SerializedProperty property) { return(GenericPropertyDrawer.GetHeight(property, ValueType) > MultilineThreshold); }
private Rect GetConstantMultilineRect(Rect position, Rect valueRect) { return(new Rect(position.x, valueRect.y + EditorGUIUtility.singleLineHeight, position.width, GenericPropertyDrawer.GetHeight(constantValue, ValueType))); }