--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").UISlidertextField = Space.Host.GetReference("Text Field").UITextOnValueChanged=function()Space.UI.MasterVolume = slider.NormalizedValue *100textField.Text = Space.UI.MasterVolumeendslider.OnValueChanged(OnValueChanged)
--clicking this object will toggle a Sliders's Enabled statusthisGameObject = Space.Host.ExecutingObjectslider = Space.Host.GetReference("slider").UISlider --make sure to add this reference to the Scripting Runtime componentOnClick=function()slider.Enabled =not slider.EnabledendthisGameObject.AddClickable()thisGameObject.Clickable.OnClick(OnClick)
Interactable
bool Interactablegetset
Use to enable or disable the ability to interact with the slider.
--clicking this object will toggle a Sliders's Interactable statusthisGameObject = Space.Host.ExecutingObjectslider = Space.Host.GetReference("slider").UISlider --make sure to add this reference to the Scripting Runtime componentOnClick=function()slider.Interactable =not slider.InteractableendthisGameObject.AddClickable()thisGameObject.Clickable.OnClick(OnClick)
Direction
int Directiongetset
The direction of the slider (0 to 4). 0 Left To Right, 1 Right To Left, 2 Bottom To Top, 3 Top To Bottom
Space.Host.ExecutingObject.UISlider.Direction =1
MinValue
float MinValuegetset
The minimum allowed value of the slider.
Space.Host.ExecutingObject.UISlider.MinValue =10
MaxValue
float MaxValuegetset
The maximum allowed value of the slider.
Space.Host.ExecutingObject.UISlider.MaxValue =20
WholeNumbers
bool WholeNumbersgetset
Should the value only be allowed to be whole numbers?
--clicking this object will toggle a Sliders's Whole Numbers statusthisGameObject = Space.Host.ExecutingObjectslider = Space.Host.GetReference("slider").UISlider --make sure to add this reference to the Scripting Runtime componentOnClick=function()slider.WholeNumbers =not slider.WholeNumbersendthisGameObject.AddClickable()thisGameObject.Clickable.OnClick(OnClick)
Value
float Valuegetset
The current value of the slider.
Space.Host.ExecutingObject.UISlider.Value =20
NormalizedValue
float NormalizedValuegetset
The current value of the slider normalized into a value between 0 and 1.
--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").UISlidertextField = Space.Host.GetReference("Text Field").UITextOnValueChanged=function()Space.UI.MasterVolume = slider.NormalizedValue *100textField.Text = Space.UI.MasterVolumeendslider.OnValueChanged(OnValueChanged)