SUISlider
Index
Functions Index
Function Name
Properties Index
Property Name
Functions
OnValueChanged
Parameter
Type
Description
function ValueChanged()
--
end
Space.Host.ExecutingObject.UISlider.OnValueChanged(ValueChanged)--This script will make moving a slider control the Master Volume
--and also update a text field with the current Master Volume
--[You need to add the slider and text field as a reference]
slider = Space.Host.GetReference("Slider").UISlider
textField = Space.Host.GetReference("Text Field").UIText
OnValueChanged = function()
Space.UI.MasterVolume = slider.NormalizedValue * 100
textField.Text = Space.UI.MasterVolume
end
slider.OnValueChanged(OnValueChanged)Space.Host.ExecutingObject.UISlider.Enabled = false --clicking this object will toggle a Sliders's Enabled status
thisGameObject = Space.Host.ExecutingObject
slider = Space.Host.GetReference("slider").UISlider
--make sure to add this reference to the Scripting Runtime component
OnClick = function()
slider.Enabled = not slider.Enabled
end
thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)Space.Host.ExecutingObject.UISlider.Interactable = true--clicking this object will toggle a Sliders's Interactable status
thisGameObject = Space.Host.ExecutingObject
slider = Space.Host.GetReference("slider").UISlider
--make sure to add this reference to the Scripting Runtime component
OnClick = function()
slider.Interactable = not slider.Interactable
end
thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)Space.Host.ExecutingObject.UISlider.Direction = 1Space.Host.ExecutingObject.UISlider.MinValue = 10Space.Host.ExecutingObject.UISlider.MaxValue = 20Space.Host.ExecutingObject.UISlider.WholeNumbers = true--clicking this object will toggle a Sliders's Whole Numbers status
thisGameObject = Space.Host.ExecutingObject
slider = Space.Host.GetReference("slider").UISlider
--make sure to add this reference to the Scripting Runtime component
OnClick = function()
slider.WholeNumbers = not slider.WholeNumbers
end
thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)Space.Host.ExecutingObject.UISlider.Value = 20Space.Host.ExecutingObject.UISlider.NormalizedValue = 0.5--This script will make moving a slider control the Master Volume
--and also update a text field with the current Master Volume
--(example: custom UI)
--[You need to add the slider and text field as a reference]
slider = Space.Host.GetReference("Slider").UISlider
textField = Space.Host.GetReference("Text Field").UIText
OnValueChanged = function()
Space.UI.MasterVolume = slider.NormalizedValue * 100
textField.Text = Space.UI.MasterVolume
end
slider.OnValueChanged(OnValueChanged)Space.Host.ExecutingObject.UISlider.NormalColor = Color.RedSpace.Host.ExecutingObject.UISlider.HighlightedColor = Color.RedSpace.Host.ExecutingObject.UISlider.PressedColor = Color.RedlSpace.Host.ExecutingObject.UISlider.DisabledColor = Color.RedSpace.Host.ExecutingObject.UISlider.ColorMultiplier = 1.2theGameObject = Space.Host.ExecutingObject.UISlider.GameObject