# Button(Vector3, Quaternion, float, float, CapFunction)

> Make a 3D Button.

## Definition

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

```csharp
public static bool Button(Vector3 position, Quaternion direction, float size, float pickSize, Handles.CapFunction capFunction)
```

### Parameters

**** (\[Vector3]\(/engine/6000.6/script-reference/unityengine/vector3)): The position to draw the button in the space of [Handles.matrix](/engine/6000.6/script-reference/unityeditor/handles/matrix.md).**** (\[Quaternion]\(/engine/6000.6/script-reference/unityengine/quaternion)): The rotation of the button in the space of [Handles.matrix](/engine/6000.6/script-reference/unityeditor/handles/matrix.md).**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The visual size of the handle. Use [HandleUtility.GetHandleSize](/engine/6000.6/script-reference/unityeditor/handleutility/gethandlesize.md) if you want a constant screen-space size.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The size of the button for the purpose of detecting a click. Use [HandleUtility.GetHandleSize](/engine/6000.6/script-reference/unityeditor/handleutility/gethandlesize.md) if you want a constant screen-space size.**** (\[CapFunction]\(/engine/6000.6/script-reference/unityeditor/handles/capfunction)): The draw style of the button.

### Returns

| Type                                                          | Description                           |
| ------------------------------------------------------------- | ------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True when the user clicks the button. |

### Remarks

This button works like one drawn with [GUI.Button](/engine/6000.6/script-reference/unityengine/gui/button.md), but it has a 3D position and is drawn by a handle function.

![ButtonHandle (Button(Vector3, Quaternion, float, float, CapFunction))](/api/media?file=/engine/6000.6/media/images/ButtonHandle.png)

*Button Handle as a rectangle in the Scene View.*

Add the following script to your Assets folder as ButtonExample.cs and add the ButtonExample component to an object in a Scene.

```csharp
using UnityEngine;

public class ButtonExample : MonoBehaviour {}
```

Add the following script to Assets/Editor as ButtonExampleEditor.cs and select the object with the ButtonExample component.

```csharp
using UnityEditor;
using UnityEngine;

[CustomEditor(typeof(ButtonExample)), CanEditMultipleObjects]
class ButtonExampleEditor : Editor
{
    protected virtual void OnSceneGUI()
    {
        ButtonExample buttonExample = (ButtonExample)target;

        Vector3 position = buttonExample.transform.position + Vector3.up * 2f;
        float size = 2f;
        float pickSize = size * 2f;

        if (Handles.Button(position, Quaternion.identity, size, pickSize, Handles.RectangleHandleCap))
            Debug.Log("The button was pressed!");
    }
}
```
