findEntity(named:)
Searches the scene’s anchor entity hierarchies for an entity with the given name.
Declaration
@MainActor @preconcurrency func findEntity(named name: String) -> Entity?Parameters
- name:
The name of the entity for which to search.
Return Value
The first entity found with the given name, or nil if none is found.
Discussion
The findEntity(named:) method conducts a depth-first, recursive search over all of the scene’s entities for one whose name property matches the given name. The method returns the first match. Entity names need not be unique.