Notifications
Article
Simple Vector3 MinMax and float modifier
Published 9 months ago
64
0
Simple Vector3 MinMax and float modifier


/// <summary> /// Simple Min Max for Vector 3 with float modifier /// </summary> /// <param name="min"> The min Vector3</param> /// <param name="max"> The max Vector3</param> /// <param name="minValue"> The min value for the Vector3</param> /// <param name="maxValue"> The max value for the Vector3</param> void MinMaxVector(ref Vector3 min, ref Vector3 max, Vector3 minValue, Vector3 maxValue) { EditorGUILayout.Space(); EditorGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); min.x = EditorGUILayout.FloatField(min.x, GUILayout.Width(50)); GUILayout.FlexibleSpace(); EditorGUILayout.LabelField("X", EditorStyles.boldLabel, GUILayout.Width(13)); GUILayout.FlexibleSpace(); max.x = EditorGUILayout.FloatField(max.x, GUILayout.Width(50)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); EditorGUILayout.MinMaxSlider(ref min.x, ref max.x, minValue.x, maxValue.x); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); min.y = EditorGUILayout.FloatField(min.y, GUILayout.Width(50)); GUILayout.FlexibleSpace(); EditorGUILayout.LabelField("Y", EditorStyles.boldLabel, GUILayout.Width(13)); GUILayout.FlexibleSpace(); max.y = EditorGUILayout.FloatField(max.y, GUILayout.Width(50)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); EditorGUILayout.MinMaxSlider(ref min.y, ref max.y, minValue.y, maxValue.z); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); min.z = EditorGUILayout.FloatField(min.z, GUILayout.Width(50)); GUILayout.FlexibleSpace(); EditorGUILayout.LabelField("Z", EditorStyles.boldLabel, GUILayout.Width(13)); GUILayout.FlexibleSpace(); max.z = EditorGUILayout.FloatField(max.z, GUILayout.Width(50)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); EditorGUILayout.MinMaxSlider(ref min.z, ref max.z, minValue.z, maxValue.z); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); }

Baptiste
Tool Programmer and Developer - Programmer
7
Comments