--This script will make an input field update a text field --with character count in real-time every time a character is typed/removed--[Text field and Input fields need to be added as references (scripting runtime)]thisObject = Space.Host.ExecutingObjectinputField = Space.Host.GetReference("The Input Field").UIInputFieldtextField = Space.Host.GetReference("The Text Field").UITextOnValueChanged=function() textField.Text ="Count= " ..string.len(inputField.Text)endthisObject.UIInputField.OnValueChanged(OnValueChanged)
OnEndEdit
void OnEndEdit (Closure callback)
Given function will be called when editing has ended
--This script will make an input field update a text field --as soon as someone has finished typing in it--Text field and Input fields need to be added as references (scripting runtime)thisObject = Space.Host.ExecutingObjectinputField = Space.Host.GetReference("The Input Field").UIInputFieldtextField = Space.Host.GetReference("The Text Field").UITextOnEndEdit=function() textField.Text = inputField.TextendSpace.Host.ExecutingObject.UIInputField.OnEndEdit(OnEndEdit)
--the below script makes this object set Browser URL according to what's written in text field--[Required: This object needs a Browser and InputField objects to be added as reference to references section in Scripting Runtime component]thisGameObject = Space.Host.ExecutingObjectwebBrowser = Space.Host.GetReference("Browser")urlField = Space.Host.GetReference("URL Field")OnClick=function()webBrowser.Browser.SetURL = urlField.UIInputField.TextendurlField.UIInputField.Text = https://www.youtube.comthisGameObject.AddClickable()thisGameObject.Clickable.Tooltip ="Click to set URL"thisGameObject.Clickable.OnClick(OnClick)
--clicking this object will toggle a UIInputField's Enabled statusthisGameObject = Space.Host.ExecutingObjectinputfield = Space.Host.GetReference("inputfield").UIInputField --make sure to add this reference to the Scripting Runtime componentOnClick=function()inputfield.Enabled =not inputfield.EnabledendthisGameObject.AddClickable()thisGameObject.Clickable.OnClick(OnClick)
--clicking this object will toggle a UIInputField's interactable statusthisGameObject = Space.Host.ExecutingObjectinputfield = Space.Host.GetReference("inputfield").UIInputField --make sure to add this reference to the Scripting Runtime componentOnClick=function()inputfield.Interactable =not inputfield.InteractableendthisGameObject.AddClickable()thisGameObject.Clickable.OnClick(OnClick)
IsFocused
bool IsFocusedget
Does the InputField currently have focus and is able to process events.
--clicking this object will toggle a UIInputField's ReadOnly statusthisGameObject = Space.Host.ExecutingObjectinputfield = Space.Host.GetReference("inputfield").UIInputField --make sure to add this reference to the Scripting Runtime componentOnClick=function()inputfield.ReadOnly =not inputfield.ReadOnlyendthisGameObject.AddClickable()thisGameObject.Clickable.OnClick(OnClick)