Selection System
Getting to know the Heathen selection system
Last updated
Getting to know the Heathen selection system
Last updated
Support us as a and get instant access to all our assets, exclusive tools and assets, escalated support and issue tracking and our gratitude. These articles are made possible by our ... become a sponsor today!
UX provides an easy to use, flexible, searchable multi-select system. Read more about the interface in its API article.
A selectable object is simply any game object which includes the component. This component exposes the system, a selection changed event and provides easy access to check for and change the selection state of the object its attached to.
at start will register them selves with the interface and deregister them selves on destroy. This means you can search for selectable objects in a more efficient manner than simply searching all game objects. The API.Selection interface also stores a collection of the currently selected Selectable Objects. You can use the API.Selection interface to search all Selectable Objects or limit your search to only those that are selected.
Why search?
This single selection system can handle all selectable things regardless of type and use however your various game systems likely need to understand what is selected or at least what types of things are selected, hence the search feature.
Imagine your creating an RTS, you have various things that can be selected including buildings, resource nodes and of course units, units have various types and categories such as naval, air, land, infantry, calvary, artillery.
You can now let your users do a simple box selection and register all contained selectable as selected. Your unit command system can then search getting back only those that are units and can be commanded.
results now contains all of the selected units, you can search for multiple tags, you can return all matching selected or just the first and you can also search all selectable rather or not they are selected.
For example many RTS games let the user press a single button to select all workers
Tags can be added and removed at run time based on state ... imagine then that we added the Available tag to our workers when they where not doing anything and removed it when they where
Now we have a list of all the idle workers and could simply select them all
These are just a few simple examples of what can be done with such a flexible searchable selection system