GUILayout.Buttonstatic function Button (image : Texture, params options : GUILayoutOption[]) : booleanstatic function Button (text : String, params options : GUILayoutOption[]) : booleanstatic function Button (content : GUIContent, params options : GUILayoutOption[]) : booleanstatic function Button (image : Texture, style : GUIStyle, params options : GUILayoutOption[]) : booleanstatic function Button (text : String, style : GUIStyle, params options : GUILayoutOption[]) : booleanstatic function Button (content : GUIContent, style : GUIStyle, params options : GUILayoutOption[]) : booleanParameters
Returnsboolean - /true/ when the users clicks the button DescriptionMake a single press button. The user clicks them and something happens immediately.
JavaScripts
// Draws a button with an image and a button with text
var tex : Texture; function OnGUI() { if(!tex) { Debug.LogError("No texture found, please assign a texture on the inspector"); } if(GUILayout.Button (tex)) { Debug.Log("Clicked the image"); } if(GUILayout.Button ("I am a regular Automatic Layout Button")) { Debug.Log("Clicked Button"); } } using UnityEngine;
using System.Collections; public class example : MonoBehaviour { public Texture tex; void OnGUI() { if (!tex) Debug.LogError("No texture found, please assign a texture on the inspector"); if (GUILayout.Button(tex)) Debug.Log("Clicked the image"); if (GUILayout.Button("I am a regular Automatic Layout Button")) Debug.Log("Clicked Button"); } } import UnityEngine
import System.Collections class example(MonoBehaviour): public tex as Texture def OnGUI(): if not tex: Debug.LogError('No texture found, please assign a texture on the inspector') if GUILayout.Button(tex): Debug.Log('Clicked the image') if GUILayout.Button('I am a regular Automatic Layout Button'): Debug.Log('Clicked Button')
|

