Hierarchical Search is a library of flexible methods that can fetch GameObjects and Components from any open scene, based on a variety of filtering parameters. It can be useful for dynamic initialization and for searching for specific types of Objects at runtime or in the Editor.
Description
The methods provided in the Hierarchical Search Scripting Extension make the process of fetching Objects from the scene more convenient and optimized.
For instance:
- If you need references to a set of GameObjects (like Colliders, which are present throughout the scene), but only from the children (one level deep) of a GameObject, using the built-in GetComponentsInChildren and filtering for the relevant ones is more expensive and can generate complex boilerplate code. This tool can also filter by part of a name (substring).
- If the number of results needed is known beforehand, the search can terminate as soon as it has collected that many.
- It has the potential to be very powerful for Editor Extensions that involve fetching references from the Scene Hierarchy.
- It can also operate on Objects in scenes other than the caller's own scene or the active scene, which is not possible with most out-of-the-box solutions.
These are just a few scenarios and far from the full extent of the capabilities offered by this tool.