/// <summary> /// Raises when Random Between Two Curves has been selected. /// </summary> /// <param name="position">Position.</param> private void OnRandomBetweenTwoCurves(Rect position) { position.height = EditorGUIUtility.singleLineHeight; HydraEditorUtils.DrawUnindented(() => HydraEditorUtils.ToggleLeftField(position, s_LinearLabel, m_LinearProperty)); Rect vector3Rect = new Rect(position); vector3Rect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; HydraEditorUtils.DrawUnindented(() => EditorGUI.PropertyField(vector3Rect, m_CurvesAProperty, GUIContent.none)); vector3Rect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; HydraEditorUtils.DrawUnindented(() => EditorGUI.PropertyField(vector3Rect, m_CurvesBProperty, GUIContent.none)); }
/// <summary> /// Raises when Random Between Two Constants has been selected. /// </summary> /// <param name="position">Position.</param> private void OnRandomBetweenTwoConstants(Rect position) { HydraEditorUtils.DrawUnindented(() => HydraEditorUtils.ToggleLeftField(position, s_LinearLabel, m_LinearProperty)); position.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; HydraEditorUtils.DrawUnindented(() => RandomBlendField(position)); Rect gradientRect = new Rect(position); gradientRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; gradientRect.width = (gradientRect.width - HydraEditorUtils.STANDARD_HORIZONTAL_SPACING) / 2.0f; HydraEditorUtils.DrawUnindented(() => EditorGUI.PropertyField(gradientRect, m_ConstValueAProperty, GUIContent.none)); gradientRect.x += gradientRect.width; HydraEditorUtils.DrawUnindented(() => EditorGUI.PropertyField(gradientRect, m_ConstValueBProperty, GUIContent.none)); }
/// <summary> /// Override this method to make your own GUI for the property /// </summary> /// <param name="position">Position</param> /// <param name="prop">Property</param> /// <param name="label">Label</param> public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label) { label = EditorGUI.BeginProperty(position, label, prop); FindProperties(prop); position.height = EditorGUIUtility.singleLineHeight; position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label); position.width = HORIZONTAL_SPACING; HydraEditorUtils.DrawUnindented(() => HydraEditorUtils.ToggleLeftField(position, s_XLabel, m_XProperty)); position.x += HORIZONTAL_SPACING; HydraEditorUtils.DrawUnindented(() => HydraEditorUtils.ToggleLeftField(position, s_YLabel, m_YProperty)); position.x += HORIZONTAL_SPACING; HydraEditorUtils.DrawUnindented(() => HydraEditorUtils.ToggleLeftField(position, s_ZLabel, m_ZProperty)); EditorGUI.EndProperty(); }