// Toast.cs // Click this object to get a notification card (a toast) at the top right of the screen: an icon on the left, a title // and a line of text beside it. It shows for 10 seconds; text that does not fit the card is cut and ends with "..". // Works on desktop, mobile and in VR. // // Set up: put this script on a clickable object. Icon (optional): drop a texture from your inventory on it. Title and // Description: what the card says. Everyone Button (optional): an object that shows the card to everybody in the // world at once. using IHXR.Simulation; public class Toast : ScriptBase { [Tooltip("Optional: a picture from your inventory, shown on the left of the card.")] public TextureItem Icon; public string Title = "Welcome!"; [Tooltip("The text on the card. Long text is cut to fit and ends with \"..\".")] public string Description = "Thanks for visiting. Have a look around and say hello in chat."; public string ClickHint = "Show a notification"; [Tooltip("Optional: an object that shows the card to everybody in the world at once.")] public SceneObject EveryoneButton; public override void Start() { MakeInteractable(click => ShowToast(click.Username, Icon, Title, Description), true, null, true, 10f, ClickHint); if (EveryoneButton != null && !EveryoneButton.IsNull) MakeInteractable(EveryoneButton, click => ShowToastToEveryone(Icon, Title, Description), true, null, true, 10f, "Show everyone the notification"); } }