Объявление
public static bool RepeatButton(Texture image, params GUILayoutOption[] options);public static bool RepeatButton(string text, params GUILayoutOption[] options);
public static bool RepeatButton(GUIContent content, params GUILayoutOption[] options);
public static bool RepeatButton(Texture image, GUIStyle style, params GUILayoutOption[] options);
public static bool RepeatButton(string text, GUIStyle style, params GUILayoutOption[] options);
public static bool RepeatButton(GUIContent content, GUIStyle style, params GUILayoutOption[] options);
Параметры
text | Текст для отображения на кнопке. |
image | Текстура для отображения на кнопке. |
content | Текст, изображение и всплывающая подсказка для этой кнопки. |
style | Используемый стиль. Если его не указать, используется стиль button из текущего GUISkin. |
options | Необязательный список параметров макета, определяющих дополнительные свойства макета. Любые переданные здесь значения переопределяют настройки, заданные style .Смотрите так же: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight. |
Возвращает
booltrue
когда удерживает мышь.
Описание
Создайте повторяющуюся кнопку. Кнопка возвращает значение true, пока пользователь удерживает кнопку мыши.

using UnityEngine;
public class ExampleScript : MonoBehaviour
{
// Draws a button with an image and a button with text
Texture tex;
void OnGUI()
{
if (!tex)
{
Debug.LogError("No texture found, please assign a texture on the inspector");
}
if (GUILayout.RepeatButton(tex))
{
Debug.Log("Clicked the image");
}
if (GUILayout.RepeatButton("I am a regular Automatic LayoutButton"))
{
Debug.Log("Clicked Button");
}
}
}