SUIButton
ClientComposants
Dans cette classeOnClick
Membres 9
| Fonction | OnClick | Invoke when a user clicks the button and releases it. |
| Propriété | Enabled | Whether the button component is Enabled. |
| Propriété | Interactable | Enable Interactable if you want this button to accept input. |
| Propriété | NormalColor | The normal color of the control. |
| Propriété | HighlightedColor | The color of the control when it is highlighted. |
| Propriété | PressedColor | The color of the control when it is pressed. |
| Propriété | DisabledColor | The color of the control when it is disabled. |
| Propriété | ColorMultiplier | This multiplies the tint color for each transition by its value. |
| Propriété | GameObject | – |
Fonctions
OnClick
void OnClick(Closure callback)
Invoke when a user clicks the button and releases it.
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| callback | Closure | – |
Valeurs de retour
void
Exemple
Lua
function OnClickFunction()
--
end
Space.Host.ExecutingObject.UIButton.OnClick(OnClickFunction)
Propriétés
Enabled
bool Enabled {get; set; }
Whether the button component is Enabled.
Exemple
Lua
Space.Host.ExecutingObject.UIButton.Enabled = true
Lua
--clicking this object will toggle Enable/Disable an object's Button component
thisGameObject = Space.Host.ExecutingObject
button = Space.Host.GetReference("button").UIButton
--make sure to add this reference to the Scripting Runtime component
OnClick = function()
button.Enabled = not button.Enabled
end
thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)
Interactable
bool Interactable {get; set; }
Enable Interactable if you want this button to accept input.
Exemple
Lua
Space.Host.ExecutingObject.UIButton.Interactable = true
Lua
--clicking this object will toggle Interactable status on an object's Button component
thisGameObject = Space.Host.ExecutingObject
button = Space.Host.GetReference("button").UIButton
--make sure to add this reference to the Scripting Runtime component
OnClick = function()
button.Interactable= not button.Interactable
end
thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)
NormalColor
The normal color of the control.
Exemple
Lua
Space.Host.ExecutingObject.UIButton.NormalColor = Color.Red
HighlightedColor
The color of the control when it is highlighted.
Exemple
Lua
Space.Host.ExecutingObject.UIButton.NormalColor = Color.Red
PressedColor
The color of the control when it is pressed.
Exemple
Lua
Space.Host.ExecutingObject.UIButton.PressedColor = Color.Red
DisabledColor
The color of the control when it is disabled.
Exemple
Lua
Space.Host.ExecutingObject.UIButton.PressedColor = Color.Red
ColorMultiplier
float ColorMultiplier {get; set; }
This multiplies the tint color for each transition by its value. With this you can create colors greater than 1 to brighten the colors on graphic elements whose base color is less than white.
Exemple
Lua
Space.Host.ExecutingObject.UIButton.ColorMultiplier = Color.Red
GameObjectLecture seule
Exemple
Lua
Space.Host.ExecutingObject.UIButton.GameObject = Color.Red



