Building Hats-based tools
In addition to the built-in functionality, Hats provides API so you can create tools that provide a tailored experienced to their users.
How to create your own tool
In general, the idea is to create tools (or, more specifically, their UI) that looks or acts differently based on which Team or Workspace is enabled.
This usually requires two steps:
Define which Workspace or Team to look for. You can either:
Hardcode the information in C#.
Allow the user to choose from a UI, using a Dropdown or some other control that allows to specify what to look for (see UI elements below). This way you would be creating a tool that the user can configure for themselves.
Use this information to tweak the tool's behaviour, by using Hats' public API.
UI elements
To facilitate the task of creating tools, Hats comes with UI Elements that you can use in your UIs to allow the user to choose a workspace or a Team.
The built-in UI elements are only available for UI Toolkit. For IMGUI components, you will need to build them yourself.
Team Picker Dropdown
This UI automatically displays existing teams in a dropdown. Like other MaskField
in Unity, the value is stored as an int
bitmask, where 0 means no Team, and -1 means all Teams.
To use it, add an element of class TeamPickerDropdown
to your UIs.
Workspace Selector UI
API
Hats provides a host of public API to query the current state of workspaces and Teams.
Look into the static classes Workspaces
and Teams
in the Hats.Editor
namespace for the full list of public API.
Last updated