A summary button
Updated
A UI Button asks the guide’s AI Summarizer for a summary of the visitor’s chat: the script checks availability first, then generates and downloads it, reporting each step in a label.
Press Download summary: without the AI service the label explains that summaries are not available, which is the script's first check. With the service, chat with the guide first, then the button saves a PDF. Drag outside the panels to orbit the camera, scroll to zoom.
A summary button
#pragma lifecycle(startup)
let summarizer;let status;
async function makeSummary() { const availability = summarizer.getSummaryAvailability(); if (!availability.available) { status.setProps({ text: availability.reason || 'Summaries are not available.' }); return; } status.setProps({ text: 'Preparing your summary…' }); try { const result = await summarizer.generateSummary(); if (result.status === 'empty') { status.setProps({ text: 'Talk to the guide first, then try again.' }); return; } status.setProps({ text: 'Your summary is ready.' }); await summarizer.downloadSummary({ jobId: result.jobId, format: 'pdf' }); } catch (error) { status.setProps({ text: 'The summary failed. Please try again.' }); }}
function startup() { summarizer = findEntity('Guide').getComponent(AISummarizerComponent); status = findEntity('Summary Status').getComponent(UILabelComponent); on('summary/make', (event) => { if (event.eventType === EventType.UIButton.Press) makeSummary(); });}How it works
Section titled “How it works”The script is explained step by step in A summary button.
Open it in XR Creator
Section titled “Open it in XR Creator”Download the project file below, then import it in XR Hub with Projects › New › Import, as described in Projects and templates. It opens in XR Creator with the same scene you see running above, each script already attached to its Behavior entity. From there you can edit the scripts, adjust components and their props, preview your changes, and deploy the result as a world of your own.
SummaryButton.xrproj