Link
Updated
Opens a web link when the entity is clicked.
- Type
comp-link- Script class
LinkComponent- Per entity
- One
- Version
- 1.0.0
Read about it in Frames and links: what it does, how to use it from a script, and examples.
Events
Section titled “Events”Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.
Link::open
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
A tracked ticket buttonA UI button with a Link opens a ticket page whose address records the room the visitor came from; pressing T opens it from a script too, and every opening is counted from the Link::open event.
Press the Tickets button, or click the view and press T: the page opens in a new tab (example.com) and the log counts the openings. Drag to orbit the camera, scroll to zoom.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(LinkComponent); if (component) log(component.props);}