# FloatField

> Makes a text field for entering floats.

## Definition

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

## FloatField(Rect, float, GUIStyle)

Makes a text field for entering floats.

```csharp
public static float FloatField(Rect position, float value, GUIStyle style)
```

### Parameters

**** (\[Rect]\(/engine/6000.0/script-reference/unityengine/rect)): Rectangle on the screen to use for the float field.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The value to edit.**** (\[GUIStyle]\(/engine/6000.0/script-reference/unityengine/guistyle)): Optional [GUIStyle](/engine/6000.0/script-reference/unityengine/guistyle.md).

### Returns

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

### Remarks

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

*Float Field in an Editor Window.*

### Examples

```csharp
using UnityEngine;
using UnityEditor;

public class EditorGUIFloatField : EditorWindow
{
    float sizeMultiplier = 1;

    [MenuItem("Examples/Scale selected Object")]
    static void Init()
    {
        var window = GetWindow<EditorGUIFloatField>();
        window.position = new Rect(0, 0, 210, 30);
        window.Show();
    }

    void OnGUI()
    {
        sizeMultiplier = EditorGUI.FloatField(new Rect(3, 3, 150, 20),
            "Increase scale by:",
            sizeMultiplier);

        if (GUI.Button(new Rect(160, 3, 45, 20), "Scale!"))
        {
            Selection.activeTransform.localScale = Selection.activeTransform.localScale * sizeMultiplier;
        }
    }
}
```

## FloatField(Rect, string, float, GUIStyle)

Makes a text field for entering floats.

```csharp
public static float FloatField(Rect position, string label, float value, GUIStyle style)
```

### Parameters

**** (\[Rect]\(/engine/6000.0/script-reference/unityengine/rect)): Rectangle on the screen to use for the float field.**** (\[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.0/script-reference/unityengine/guistyle)): Optional [GUIStyle](/engine/6000.0/script-reference/unityengine/guistyle.md).

### Returns

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

### Remarks

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

*Float Field in an Editor Window.*

### Examples

```csharp
using UnityEngine;
using UnityEditor;

public class EditorGUIFloatField : EditorWindow
{
    float sizeMultiplier = 1;

    [MenuItem("Examples/Scale selected Object")]
    static void Init()
    {
        var window = GetWindow<EditorGUIFloatField>();
        window.position = new Rect(0, 0, 210, 30);
        window.Show();
    }

    void OnGUI()
    {
        sizeMultiplier = EditorGUI.FloatField(new Rect(3, 3, 150, 20),
            "Increase scale by:",
            sizeMultiplier);

        if (GUI.Button(new Rect(160, 3, 45, 20), "Scale!"))
        {
            Selection.activeTransform.localScale = Selection.activeTransform.localScale * sizeMultiplier;
        }
    }
}
```

## FloatField(Rect, GUIContent, float, GUIStyle)

Makes a text field for entering floats.

```csharp
public static float FloatField(Rect position, GUIContent label, float value, GUIStyle style)
```

### Parameters

**** (\[Rect]\(/engine/6000.0/script-reference/unityengine/rect)): Rectangle on the screen to use for the float field.**** (\[GUIContent]\(/engine/6000.0/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.0/script-reference/unityengine/guistyle)): Optional [GUIStyle](/engine/6000.0/script-reference/unityengine/guistyle.md).

### Returns

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

### Remarks

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

*Float Field in an Editor Window.*

### Examples

```csharp
using UnityEngine;
using UnityEditor;

public class EditorGUIFloatField : EditorWindow
{
    float sizeMultiplier = 1;

    [MenuItem("Examples/Scale selected Object")]
    static void Init()
    {
        var window = GetWindow<EditorGUIFloatField>();
        window.position = new Rect(0, 0, 210, 30);
        window.Show();
    }

    void OnGUI()
    {
        sizeMultiplier = EditorGUI.FloatField(new Rect(3, 3, 150, 20),
            "Increase scale by:",
            sizeMultiplier);

        if (GUI.Button(new Rect(160, 3, 45, 20), "Scale!"))
        {
            Selection.activeTransform.localScale = Selection.activeTransform.localScale * sizeMultiplier;
        }
    }
}
```
