Skip to content

Entities

Updated

Every object in a scene is an entity: a 3D model, a light, a camera, a sound, a video screen, a UI panel, a spawn point. If it is in the scene, it is an entity.

Part What it is
A type What kind of object it is, such as a primitive mesh, a point light or a UI button. The type decides which components it starts with.
A name How you find it, in the Hierarchy and from scripts with findEntity('Name'). Several entities may share a name.
An id A code that belongs to this entity only, kept when the scene is saved and when you rename it.
A place in the scene Its transform: a position, a rotation and a scale, relative to its parent.
A parent and children Entities nest: an entity placed inside another moves, turns and scales with it. Move a car and its wheels move with it.
Components What it looks like and what it does. See Components.

Entities form a tree, shown in XR Creator’s Hierarchy panel. A lamp can hold its bulb light; a table can hold the objects on it. Moving the parent moves everything inside it.

Every entity is on a layer, a numbered group set in XR Creator. A layer lets you treat its entities as one: lock them all so they cannot be picked by accident while you edit, switch them all off, or let clicks pass through them, like a pane of glass in front of a button.

The runtime offers many entity types, grouped by what they are: scene structure (groups and scripts), meshes and models, effects, media (images, video, text, documents), lights, cameras, audio, navigation (spawn points, travel points), interaction, UI, logic and AI agents, and XR. The entity reference lists every type.

FindTheDoor.jx
#pragma lifecycle(startup)
function startup() {
const door = findEntity('Door'); // look an entity up by name
door.setPosition(0, 0, -3); // move it
log(door.name, 'is at', door.position.z);
}