Searching the Hierarchy
By Name
const found = app.root.findByName("Player");
See findByName
.
By Tag
Tags are string labels you can assign to Entities (Tags
).
entity.tags.add("enemy");
const enemies = app.root.findByTag("enemy");
tip
Use tags for grouping related Entities. Tag-based searches are typically faster and more flexible than deep name-based searches.
By Component
const lights = app.root.findComponents("light");
See findComponents
.
Recursion and Scope
- Searches can be started from any Entity, not just
app.root
. - Searching from a smaller subtree is faster than searching the whole scene.