Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


FloatField

Make a text field for entering float values.
Read time 7 minutesLast updated 4 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor

FloatField(float, GUILayoutOption[])

Make a text field for entering float values.
public static float FloatField(float value, params GUILayoutOption[] options)

Parameters

value

The value to edit.

An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.

Returns

Type

Description

floatThe value entered by the user.

Remarks

EditorGUILayoutFloatField (FloatField)
Multiply the scale of the selected GameObject.

Examples

using UnityEngine;using UnityEditor;// Editor Script that multiplies the scale of the current selected GameObjectpublic class FloatFieldExample : EditorWindow{ float sizeMultiplier = 1.0f; [MenuItem("Examples/Scale selected Object")] static void Init() { var window = (FloatFieldExample)GetWindow(typeof(FloatFieldExample)); window.Show(); } void OnGUI() { sizeMultiplier = EditorGUILayout.FloatField("Increase scale by:", sizeMultiplier); if (GUILayout.Button("Scale")) { if (!Selection.activeGameObject) { Debug.Log("Select a GameObject first"); return; } Selection.activeTransform.localScale = Selection.activeTransform.localScale * sizeMultiplier; } }}

FloatField(float, GUIStyle, GUILayoutOption[])

Make a text field for entering float values.
public static float FloatField(float value, GUIStyle style, params GUILayoutOption[] options)

Parameters

value

The value to edit.

Optional GUIStyle.

An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.

Returns

Type

Description

floatThe value entered by the user.

Remarks

EditorGUILayoutFloatField (FloatField)
Multiply the scale of the selected GameObject.

Examples

using UnityEngine;using UnityEditor;// Editor Script that multiplies the scale of the current selected GameObjectpublic class FloatFieldExample : EditorWindow{ float sizeMultiplier = 1.0f; [MenuItem("Examples/Scale selected Object")] static void Init() { var window = (FloatFieldExample)GetWindow(typeof(FloatFieldExample)); window.Show(); } void OnGUI() { sizeMultiplier = EditorGUILayout.FloatField("Increase scale by:", sizeMultiplier); if (GUILayout.Button("Scale")) { if (!Selection.activeGameObject) { Debug.Log("Select a GameObject first"); return; } Selection.activeTransform.localScale = Selection.activeTransform.localScale * sizeMultiplier; } }}

FloatField(string, float, GUILayoutOption[])

Make a text field for entering float values.
public static float FloatField(string label, float value, params GUILayoutOption[] options)

Parameters

label

Optional label to display in front of the float field.

value

The value to edit.

An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.

Returns

Type

Description

floatThe value entered by the user.

Remarks

EditorGUILayoutFloatField (FloatField)
Multiply the scale of the selected GameObject.

Examples

using UnityEngine;using UnityEditor;// Editor Script that multiplies the scale of the current selected GameObjectpublic class FloatFieldExample : EditorWindow{ float sizeMultiplier = 1.0f; [MenuItem("Examples/Scale selected Object")] static void Init() { var window = (FloatFieldExample)GetWindow(typeof(FloatFieldExample)); window.Show(); } void OnGUI() { sizeMultiplier = EditorGUILayout.FloatField("Increase scale by:", sizeMultiplier); if (GUILayout.Button("Scale")) { if (!Selection.activeGameObject) { Debug.Log("Select a GameObject first"); return; } Selection.activeTransform.localScale = Selection.activeTransform.localScale * sizeMultiplier; } }}

FloatField(string, float, GUIStyle, GUILayoutOption[])

Make a text field for entering float values.
public static float FloatField(string label, float value, GUIStyle style, params GUILayoutOption[] options)

Parameters

label

Optional label to display in front of the float field.

value

The value to edit.

Optional GUIStyle.

An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.

Returns

Type

Description

floatThe value entered by the user.

Remarks

EditorGUILayoutFloatField (FloatField)
Multiply the scale of the selected GameObject.

Examples

using UnityEngine;using UnityEditor;// Editor Script that multiplies the scale of the current selected GameObjectpublic class FloatFieldExample : EditorWindow{ float sizeMultiplier = 1.0f; [MenuItem("Examples/Scale selected Object")] static void Init() { var window = (FloatFieldExample)GetWindow(typeof(FloatFieldExample)); window.Show(); } void OnGUI() { sizeMultiplier = EditorGUILayout.FloatField("Increase scale by:", sizeMultiplier); if (GUILayout.Button("Scale")) { if (!Selection.activeGameObject) { Debug.Log("Select a GameObject first"); return; } Selection.activeTransform.localScale = Selection.activeTransform.localScale * sizeMultiplier; } }}

FloatField(GUIContent, float, GUILayoutOption[])

Make a text field for entering float values.
public static float FloatField(GUIContent label, float value, params GUILayoutOption[] options)

Parameters

Optional label to display in front of the float field.

value

The value to edit.

An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.

Returns

Type

Description

floatThe value entered by the user.

Remarks

EditorGUILayoutFloatField (FloatField)
Multiply the scale of the selected GameObject.

Examples

using UnityEngine;using UnityEditor;// Editor Script that multiplies the scale of the current selected GameObjectpublic class FloatFieldExample : EditorWindow{ float sizeMultiplier = 1.0f; [MenuItem("Examples/Scale selected Object")] static void Init() { var window = (FloatFieldExample)GetWindow(typeof(FloatFieldExample)); window.Show(); } void OnGUI() { sizeMultiplier = EditorGUILayout.FloatField("Increase scale by:", sizeMultiplier); if (GUILayout.Button("Scale")) { if (!Selection.activeGameObject) { Debug.Log("Select a GameObject first"); return; } Selection.activeTransform.localScale = Selection.activeTransform.localScale * sizeMultiplier; } }}

FloatField(GUIContent, float, GUIStyle, GUILayoutOption[])

Make a text field for entering float values.
public static float FloatField(GUIContent label, float value, GUIStyle style, params GUILayoutOption[] options)

Parameters

Optional label to display in front of the float field.

value

The value to edit.

Optional GUIStyle.

An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.
Additional Resources: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.

Returns

Type

Description

floatThe value entered by the user.

Remarks

EditorGUILayoutFloatField (FloatField)
Multiply the scale of the selected GameObject.

Examples

using UnityEngine;using UnityEditor;// Editor Script that multiplies the scale of the current selected GameObjectpublic class FloatFieldExample : EditorWindow{ float sizeMultiplier = 1.0f; [MenuItem("Examples/Scale selected Object")] static void Init() { var window = (FloatFieldExample)GetWindow(typeof(FloatFieldExample)); window.Show(); } void OnGUI() { sizeMultiplier = EditorGUILayout.FloatField("Increase scale by:", sizeMultiplier); if (GUILayout.Button("Scale")) { if (!Selection.activeGameObject) { Debug.Log("Select a GameObject first"); return; } Selection.activeTransform.localScale = Selection.activeTransform.localScale * sizeMultiplier; } }}