A floating name tag
Updated
A styled label pinned above a box that always turns to face the camera: a UI Label entity created by a Behavior script, with a Billboard, added under the mesh.
Orbit around the box: the tag keeps facing you. Drag to orbit the camera, scroll to zoom.
A floating name tag
#pragma lifecycle(startup)
function startup() { const box = findEntity('Lemon Box');
const tag = new UILabelEntity(); tag.getComponent(UILabelComponent).setProps({ text: 'Lemon Box', fontSize: 40, padding: 12, backgroundColor: 'rgba(28, 28, 30, 0.9)', borderRadius: 14, borderColor: '#69ebed', }); tag.position.set(0, 0.8, 0); tag.addComponent(new BillboardComponent());
box.add(tag);}How it works
Section titled “How it works”The script is explained step by step in A floating name tag.
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.
FloatingNameTag.xrproj