# FloatField

> Make a text field for entering float values.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.7/script-reference/unityeditor.md)
* **Assembly:** UnityEditor.CoreModule

## FloatField(float, GUILayoutOption\[])

Make a text field for entering float values.

```csharp
public static float FloatField(float value, params GUILayoutOption[] options)
```

### Parameters

**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The value to edit.**** (\[GUILayoutOption\[]]\(/engine/6000.7/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the `style`.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.7/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.7/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.7/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.7/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.7/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.7/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.7/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.7/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                          | Description                    |
| ------------------------------------------------------------- | ------------------------------ |
| [float](https://learn.microsoft.com/dotnet/api/system.single) | The value entered by the user. |

### Remarks

![EditorGUILayoutFloatField (FloatField)](/api/media?file=/engine/6000.7/media/images/EditorGUILayoutFloatField.png)

*Multiply the scale of the selected GameObject.*

### Examples

```csharp
using UnityEngine;
using UnityEditor;

// Editor Script that multiplies the scale of the current selected GameObject

public 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.

```csharp
public static float FloatField(float value, GUIStyle style, params GUILayoutOption[] options)
```

### Parameters

**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The value to edit.**** (\[GUIStyle]\(/engine/6000.7/script-reference/unityengine/guistyle)): Optional [GUIStyle](/engine/6000.7/script-reference/unityengine/guistyle.md).**** (\[GUILayoutOption\[]]\(/engine/6000.7/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the `style`.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.7/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.7/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.7/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.7/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.7/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.7/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.7/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.7/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                          | Description                    |
| ------------------------------------------------------------- | ------------------------------ |
| [float](https://learn.microsoft.com/dotnet/api/system.single) | The value entered by the user. |

### Remarks

![EditorGUILayoutFloatField (FloatField)](/api/media?file=/engine/6000.7/media/images/EditorGUILayoutFloatField.png)

*Multiply the scale of the selected GameObject.*

### Examples

```csharp
using UnityEngine;
using UnityEditor;

// Editor Script that multiplies the scale of the current selected GameObject

public 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.

```csharp
public static float FloatField(string label, float value, params GUILayoutOption[] options)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Optional label to display in front of the float field.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The value to edit.**** (\[GUILayoutOption\[]]\(/engine/6000.7/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the `style`.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.7/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.7/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.7/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.7/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.7/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.7/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.7/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.7/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                          | Description                    |
| ------------------------------------------------------------- | ------------------------------ |
| [float](https://learn.microsoft.com/dotnet/api/system.single) | The value entered by the user. |

### Remarks

![EditorGUILayoutFloatField (FloatField)](/api/media?file=/engine/6000.7/media/images/EditorGUILayoutFloatField.png)

*Multiply the scale of the selected GameObject.*

### Examples

```csharp
using UnityEngine;
using UnityEditor;

// Editor Script that multiplies the scale of the current selected GameObject

public 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.

```csharp
public static float FloatField(string label, float value, GUIStyle style, params GUILayoutOption[] options)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Optional label to display in front of the float field.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The value to edit.**** (\[GUIStyle]\(/engine/6000.7/script-reference/unityengine/guistyle)): Optional [GUIStyle](/engine/6000.7/script-reference/unityengine/guistyle.md).**** (\[GUILayoutOption\[]]\(/engine/6000.7/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the `style`.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.7/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.7/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.7/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.7/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.7/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.7/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.7/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.7/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                          | Description                    |
| ------------------------------------------------------------- | ------------------------------ |
| [float](https://learn.microsoft.com/dotnet/api/system.single) | The value entered by the user. |

### Remarks

![EditorGUILayoutFloatField (FloatField)](/api/media?file=/engine/6000.7/media/images/EditorGUILayoutFloatField.png)

*Multiply the scale of the selected GameObject.*

### Examples

```csharp
using UnityEngine;
using UnityEditor;

// Editor Script that multiplies the scale of the current selected GameObject

public 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.

```csharp
public static float FloatField(GUIContent label, float value, params GUILayoutOption[] options)
```

### Parameters

**** (\[GUIContent]\(/engine/6000.7/script-reference/unityengine/guicontent)): Optional label to display in front of the float field.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The value to edit.**** (\[GUILayoutOption\[]]\(/engine/6000.7/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the `style`.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.7/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.7/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.7/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.7/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.7/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.7/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.7/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.7/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                          | Description                    |
| ------------------------------------------------------------- | ------------------------------ |
| [float](https://learn.microsoft.com/dotnet/api/system.single) | The value entered by the user. |

### Remarks

![EditorGUILayoutFloatField (FloatField)](/api/media?file=/engine/6000.7/media/images/EditorGUILayoutFloatField.png)

*Multiply the scale of the selected GameObject.*

### Examples

```csharp
using UnityEngine;
using UnityEditor;

// Editor Script that multiplies the scale of the current selected GameObject

public 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.

```csharp
public static float FloatField(GUIContent label, float value, GUIStyle style, params GUILayoutOption[] options)
```

### Parameters

**** (\[GUIContent]\(/engine/6000.7/script-reference/unityengine/guicontent)): Optional label to display in front of the float field.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The value to edit.**** (\[GUIStyle]\(/engine/6000.7/script-reference/unityengine/guistyle)): Optional [GUIStyle](/engine/6000.7/script-reference/unityengine/guistyle.md).**** (\[GUILayoutOption\[]]\(/engine/6000.7/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the `style`.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.7/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.7/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.7/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.7/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.7/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.7/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.7/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.7/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                          | Description                    |
| ------------------------------------------------------------- | ------------------------------ |
| [float](https://learn.microsoft.com/dotnet/api/system.single) | The value entered by the user. |

### Remarks

![EditorGUILayoutFloatField (FloatField)](/api/media?file=/engine/6000.7/media/images/EditorGUILayoutFloatField.png)

*Multiply the scale of the selected GameObject.*

### Examples

```csharp
using UnityEngine;
using UnityEditor;

// Editor Script that multiplies the scale of the current selected GameObject

public 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;
        }
    }
}
```
