Skip to content

A people counter

Updated

Reads the roster once with Participants.getSnapshot, then keeps a UI Label up to date with Participants.subscribe, flagging a roster that is still updating.

Read the label and the log. The preview has no room, so the roster is empty; in a published world the count follows people as they come and go.

A people counter

The script is explained step by step in A people counter.

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.

PeopleCounter.xrproj