Workspaces
Last updated
Last updated
The main feature of Hats is to create workspaces. A workspace can be seen as similar to an Editor layout, but is much more powerful, thanks to a variety of rules that can trigger when the workspace is enabled.
Build on Hats
In addition to using workspaces to trigger rules, you can also build tools that modify their appearance or behaviour depending on the active workspace.
When you first start Hats, a Default workspace is created and activated. This workspace has no rules, meaning that the Editor is not modified in any way.
When you remove an active workspace or something "bad" happens (i.e. the active workspace asset is deleted), Hats reverts to the Default workspace.
Workspaces are personal, so each user on the project can have their own set. workspaces are represented by a ScriptableObject of type Workspace
.
To create one, simply right-click in the Project window and choose Create > Hats > Workspace.
Once created, you can modify its properties:
Notice that identifier, icon and colour are all important because they appear in the Workspace Switcher UI, and help you identify which workspace is active at the moment.
The identifier property is the one used in the UI. You can name the asset itself a more compact name, or add who the Workspace belongs to, if you're sharing them with the team.
i.e. "Level Design" as the identifier, vs. Jonathan_LevelDesign
as the filename
The rules list contains workspace rules that trigger when the workspace becomes active. Click on the plus button to explore available types (and read all about them in the Rules section).
Once the file is setup, it's time to enable it.
Sharing workspaces
Even though workspaces are personal, because they are assets they could be shared with the rest of the team. It's up to you and the team to decide whether workspaces are personal or shared.
To assign a workspace to your list, go to Project Settings > Hats, and add it to the list of Personal Workspaces.
As you add workspaces, you will notice that they become available in the Switcher UI at the top (next to Active Workspace).
Once at least 1 workspace is added to the list, you can now switch between them.
To remove a workspace from the available ones, you do so in Project Settings > Hats. You just need to remove it from the list.
Removing a workspace from the list doesn't delete the asset. So you can safely remove workspaces to disable them, keep the asset, and re-enable them at a later point.
If you remove an active workspace, Hats automatically switches to the Default workspace.
If you want to keep them personal, you might want to save them all in a designated folder (for instance Assets/Settings/Hats/Workspaces
) and ignore that folder in your version control.