--the below scipt makes this object set Browser URL according to what's written in text field--(Example: Set URL button)--[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.Text)endurlField.UIInputField.Text ="https://www.youtube.com"thisGameObject.AddClickable()thisGameObject.Clickable.Tooltip ="Click to set URL"thisGameObject.Clickable.OnClick(OnClick)
Back
void Back ()
Equivalent to hitting the 'back' button within the browser.
Space.Host.ExecutingObject.Browser.Back()
--the below scipt makes this object a clickable that navigates Back--(Example: Browser navigation )--[Required: Browser surface object needs to be added as a reference to the Scripting Runtime component]thisGameObject = Space.Host.ExecutingObjectbrowser = Space.Host.GetReference("Browser Surface Object").BrowserOnClick=function()browser.Back()endthisGameObject.AddClickable()thisGameObject.Clickable.Tooltip ="Click to Enable/Disable browser Input"thisGameObject.Clickable.OnClick(OnClick)
Forward
void Forward ()
Equivalent to hitting the 'forward' button within the browser.
Space.Host.ExecutingObject.Browser.Forward()
--the below scipt makes this object a clickable that navigates Forward--(Example: Browser navigation )--[Required: Browser surface object needs to be added as a reference to the Scripting Runtime component]thisGameObject = Space.Host.ExecutingObjectbrowser = Space.Host.GetReference("Browser Surface Object").BrowserOnClick=function()browser.Forward()endthisGameObject.AddClickable()thisGameObject.Clickable.Tooltip ="Click to Enable/Disable browser Input"thisGameObject.Clickable.OnClick(OnClick)
Reload
void Reload ()
Refreshes and reloads the current webpage.
Space.Host.ExecutingObject.Browser.Reload()
--the below scipt makes this object a clickable that reloads the page--(Example: Browser navigation )--[Required: Browser surface object needs to be added as a reference to the Scripting Runtime component]thisGameObject = Space.Host.ExecutingObjectbrowser = Space.Host.GetReference("Browser Surface Object").BrowserOnClick=function()browser.Reload()endthisGameObject.AddClickable()thisGameObject.Clickable.Tooltip ="Click to Enable/Disable browser Input"thisGameObject.Clickable.OnClick(OnClick)
--the below scipt makes this object clear the an InputField whenever URL changes--(Example: URL Bar)--[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")OnURLChanged ()urlField.UIInputField.Text =" "endwebBrowser.Browser.OnURLChanged(OnURLChanged)
Properties
Networked
bool Networkedgetset
Should changes to this browser be streamed to other clients within the area?.
--the below scipt makes this object toggle Networking on it's parent browser--(Example: browser controls)--[Required: This object needs its parent to have the browser component]thisGameObject = Space.Host.ExecutingObjectOnClick=function()if thisGameObject.Parent.Browser.Networked then thisGameObject.Parent.Browser.Networked =false Space.Log("Browser will not be networked")else thisGameObject.Parent.Browser.Networked =true Space.Log("Browser will be networked")endendthisGameObject.AddClickable()thisGameObject.Clickable.Tooltip ="Click to toggle Networking on Browser"thisGameObject.Clickable.OnClick(OnClick)
Muted
bool Mutedgetset
Whether this Browser Surface is muted or not.
Space.Host.ExecutingObject.Browser.Muted=true
--the below scipt makes this object a clickable that mutes/unmutes a browser surface--(Example: Browser Mute button )--[Required: This object's parent needs to be an object with BrowserSurface component in it]thisGameObject = Space.Host.ExecutingObjectOnClick=function()if thisGameObject.Parent.Browser.Muted then thisGameObject.Parent.Browser.Muted =false Space.Log("Browser unmuted")else thisGameObject.Parent.Browser.Muted =true Space.Log("Browser muted")endendthisGameObject.AddClickable()thisGameObject.Clickable.Tooltip ="Click to Mute/Unmute Browser"thisGameObject.Clickable.OnClick(OnClick)
CanGoBack
bool CanGoBackget
Returns whether this Browser Surface can navigate back
--the below scipt makes this Browser object show/hide it's Forward and Back--buttons according to wether the actions are possible or not--(Example: browser navigation )--[Required: This object needs the forward and back objects added to the references section in scripting runtime]thisGameObject = Space.Host.ExecutingObjectforwardButton = Space.Host.GetReference("Forward Button")backButton = Space.Host.GetReference("Back Button")OnUpdate=function()if thisGameObject.Browser.CanGoBack then backButton.Active =trueelse backButton.Active =falseendif thisGameObject.Browser.CanGoForward then forwardButton.Active =trueelse forwardButton.Active =falseendendthisGameObject.OnUpdate(OnUpdate)
CanGoForward
bool CanGoForwardget
Returns whether this Browser Surface can navigate forward
--the below scipt makes this Browser object show/hide it's Forward and Back--buttons according to wether the actions are possible or not--(Example: browser navigation )--[Required: This object needs the forward and back objects added to the references section in scripting runtime]thisGameObject = Space.Host.ExecutingObjectforwardButton = Space.Host.GetReference("Forward Button")backButton = Space.Host.GetReference("Back Button")OnUpdate=function()if thisGameObject.Browser.CanGoBack then backButton.Active =trueelse backButton.Active =falseendif thisGameObject.Browser.CanGoForward then forwardButton.Active =trueelse forwardButton.Active =falseendendthisGameObject.OnUpdate(OnUpdate)
EnableInput
bool EnableInputgetset
Whether this Browser Surface has Input enabled or not (interactable)
--the below scipt makes this object a clickable that toggle Enable Input a browser surface--(Example: Brower Enable Input toggle button )--[Required: Browser surface object needs to be added as a reference to the Scripting Runtime component]thisGameObject = Space.Host.ExecutingObjectbrowser = Space.Host.GetReference("Browser Surface Object").BrowserOnClick=function()if browser.EnableInput then browser.EnableInput =false Space.Log("Browser input disabled")else browser.EnableInput =true Space.Log("Browser input enabled")endendthisGameObject.AddClickable()thisGameObject.Clickable.Tooltip ="Click to Enable/Disable browser Input"thisGameObject.Clickable.OnClick(OnClick)
Zoom
float Zoomgetset
Set the Zoom of the browser surface (Pixel Scaling). Positive values zoom in, negative values zoom out.
Space.Host.ExecutingObject.Browser.Zoom =2
--the below scipt make a slider control the zoom in of a browser surface--(Example: browser zoom controls)--[Required: This object needs a Browser and slider objects to be added as reference to references section in Scripting Runtime component]slider = Space.Host.GetReference("Slider").UISliderbrowser = Space.Host.GetReference("Browser")browser.Browser.SetURL("https://www.yahoo.com")OnValueChanged=function()browser.Browser.Zoom = slider.NormalizedValue *5endslider.OnValueChanged(OnValueChanged)