Searching the Hierarchy
Search by Name
const found = app.root.findByName("Player");
See findByName.
Search by Tag
Tags are string labels that can be assigned to entities (Tags).
entity.tags.add("enemy");
const enemies = app.root.findByTag("enemy");
tip
Use tags to group related entities. Tag-based searches are generally faster and more flexible than deep name-based searches.
Search by Component
const lights = app.root.findComponents("light");
See findComponents.
Recursion and Scope
- Searches can start from any entity, not just
app.root. - Searching in a smaller subtree is faster than searching the entire scene.