Name tags for every object in a group
Updated
A script gives every child of the Exhibits group a billboard UI Label with the child’s name, floating above it.
Drag to orbit the camera: the tags keep facing you. Scroll to zoom.
Name tags for every object in a group
#pragma lifecycle(startup)
// Scene: a Group named 'Exhibits' whose children are the objects to label.// Each child's name becomes its tag.function makeTag(text) { const tag = new UILabelEntity(); tag.getComponent(UILabelComponent).setProps({ text, fontSize: 28, font: 'nunito', padding: [6, 12], backgroundColor: '#0f172a', borderRadius: 10, }); tag.addComponent(new BillboardComponent()); return tag;}
function startup() { const exhibits = findEntity('Exhibits'); for (const child of [...exhibits.children]) { if (!isEntity(child)) continue; const tag = makeTag(child.name); tag.position.set(0, 1.2, 0); child.add(tag); }}How it works
Section titled “How it works”The script is explained step by step in Name tags for every object in a group.
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.
AllTags.xrproj