Version: 5.4
public static bool Button (Vector3 position, Quaternion direction, float size, float pickSize, Handles.DrawCapFunction capFunc);

Parameters

position @param position Позиция текущей точки.
direction @param rotation Вращение маркера.
size @param size Размер маркера.
pickSize The size of the button for the purpose of detecting a click.
capFunc @param normal Перпендикуляр диска.

Returns

bool True when the user clicks the button.

Description

Создает 3D кнопку.

Работает почти как обычная GUI.Button, но имеет 3D позицию и отображается только обрабатываемой функцией


Button Handle as a rectangle in the Scene View.

Важно: Используйте HandleUtility.GetHandleSize если вам нужны маркеры постоянного размера.

To use this example, place this code in a script file in the Assets/Editor folder of your project:

using UnityEngine;
using UnityEditor;

// Create a simple button in 3D space and when the user clicks over the handle // it prints a message.

[CustomEditor( typeof( ButtonChecker ) )] class ButtonHandle : Editor { void OnSceneGUI( ) { ButtonChecker b = target as ButtonChecker;

bool pressed = Handles.Button( b.transform.position + new Vector3(0, 2, 0), Quaternion.identity, 3, 3, Handles.RectangleCap ); if( pressed ) { b.checkButton = true; Debug.Log( "The button was pressed!" ); } } }

И скрипт, прикрепленный к данному маркеру:

using UnityEngine;

public class ButtonChecker : MonoBehaviour { // Usage: Place this script on the object you want to create the button on.

public bool checkButton = false; }