Line 36: | Line 36: | ||
''--add Button to object references.''<br> | ''--add Button to object references.''<br> | ||
Space.Log(button.Interactable)<br> | Space.Log(button.Interactable)<br> | ||
− | ''--return true.'' | + | ''--return true.''|6=<pre>--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)</pre> | ||
}} | }} | ||
A control that executes code in response to user interactions.
Invoke when a user clicks the button and releases it.
--add Button to object references.
function Click()
button.OnClick(function ()
Space.Log("Hello Lua!")
button.end)
Whether the button component is Enabled or not.
--add Button to object references.
Space.Log(button.Enabled)
--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)
Enable Interactable if you want this button to accept input.
--add Button to object references.
Space.Log(button.Interactable)
--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)
The normal color of the control.
--add Button to object references.
The color of the control when it is highlighted.
--add Button to object references.
The color of the control when it is pressed.
--add Button to object references.
The color of the control when it is disabled.
--add Button to object references.
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.
--add Button to object references.
Space.Log(button.ColorMultiplier)
|