Version: 5.3 (switch to 5.4b)
ЯзыкEnglish
  • C#
  • JS

Язык программирования

Выберите подходящий для вас язык программирования. Все примеры кода будут представлены на выбранном языке.

GUI.RepeatButton

Руководство
public static bool RepeatButton(Rect position, string text);
public static bool RepeatButton(Rect position, Texture image);
public static bool RepeatButton(Rect position, GUIContent content);
public static bool RepeatButton(Rect position, string text, GUIStyle style);
public static bool RepeatButton(Rect position, Texture image, GUIStyle style);
public static bool RepeatButton(Rect position, GUIContent content, GUIStyle style);

Параметры

position @param position Прямоугольник, который станет кнопкой.
text @param text Текст на кнопке.
image @param image Texture на кнопке.
content @param content Текст, изображение и всплывающая подсказка для данной кнопки.
style @param style Используемый стиль. Если не задан, то используется стиль из GUISkin.

Возврат значений

bool @return True в момент когда пользователь кликает кнопку.

Описание

Делает кнопку, которая активирована то количество времени, которое пользователь ее удерживает.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Texture btnTexture; void OnGUI() { if (!btnTexture) { Debug.LogError("Please assign a texture on the inspector"); return; } if (GUI.RepeatButton(new Rect(10, 10, 50, 50), btnTexture)) Debug.Log("Clicked the button with an image"); if (GUI.RepeatButton(new Rect(10, 70, 50, 30), "Click")) Debug.Log("Clicked the button with text"); } }