// LinkOffer.cs // Click this object to be asked whether to open a web page (your shop, a form, a video) in a new browser tab. The player // sees the address first and nothing opens unless they choose Open Link. Works on desktop, mobile and in VR (in VR the // page opens in the browser, outside VR). // // Set up: put this script on a clickable object and fill in Url (a full https:// address). Title and Message are // optional. Everyone Button (optional): an object that asks everybody in the world at once. using IHXR.Simulation; public class LinkOffer : ScriptBase { [Tooltip("The web page to open (a full http:// or https:// address).")] public string Url = "https://example.com"; public string Title = "Visit our website"; [Tooltip("Optional text shown above the address.")] public string Message = "Find out more on our website."; public string ClickHint = "Open the website"; [Tooltip("Optional: an object that asks everybody in the world at once.")] public SceneObject EveryoneButton; public override void Start() { MakeInteractable(click => OfferLink(click.Username, Url, Message, Title, opened => Log(click.Username + (opened ? " opened " : " did not open ") + Url)), true, null, true, 10f, ClickHint); if (EveryoneButton != null && !EveryoneButton.IsNull) MakeInteractable(EveryoneButton, click => OfferLink("*", Url, Message, Title), true, null, true, 10f, "Show everyone the link"); } }