Customization
UI Toolkit is utilized to render UI as opposed to UGUI. This has several benefits however the workflow may differ from what you're used to.
UI Toolkit uses style sheets to change visual aspects of the UI. So in order to customize the look of Ghost Commands you will have to create your own style sheet and override specific selectors. This may seem a bit complicated if you're not used to it, but it essentially allows for unlimited customization.
We recommend reading Unity's UI Toolkit documentation for a better overview of how USS (stylesheets) works.
To make a stylesheet, right click in your project browser > Create > UI Toolkit > Style Sheet.
Or simply type create.uss
into the command field.
Applying the style sheet
Navigate to the project settings and under the sections Runtime Settings and Editor Settings, you should find a Custom Style Sheets array. Any style sheet you add into these will get applied automatically.
In the style sheet, you simply override existing selectors to manipulate their properties. Variables can be overridden by adding a :root
selector and assigning a value to a variable property.
Note
Variable properties must be prefixed with --
. This is a general rule in style sheets. So remember to use that for your variables!
You can also override specific class selectors to change any property within them.
Specific guides are provided below to make it simpler for you to customize common properties.
Guide snippets
How to set custom icons
Custom icons can be set for any command or parameter. You can even override existing ones if you wish to. There are a few rules to follow, so let's start with command icons.
Command icons can be set in two ways: Based on their name, or based on their prefix. To set a custom icon based on the name of a command, you would do as follows:
Note
Notice we also specify the tint color. This is because, by default, any icon uses the general
--accent-color
variable, unless the property has been overridden.
Setting icons for a prefix is just as simple. We simply replace name
with prefix
in the selector.
So how about setting icons for parameters? It generally follows the same principles, but there are other rules. Here, there are also two ways of doing it. The first one is based on the parameter's type. The other is based on the name of custom suggestion attributes.
To set an icon based on the parameter type, create a selector like this:
To set an icon based on a suggestion attribute, you would type:
Naming
Selectors must be in lower-case in order for your custom icons to applied.
Styling
We recommend using white textures, as changing the color via style sheets, and respecting the general --accent-color
is easier that way.
Common variables
To modify variables, simply create a :root
selector, and override the ones you would like to change. Variables can also be overridden in specific selectors if you prefer to have finer control over where they are applied. These selectors might be helpful for that: .runtime
, .editor-light
and .editor-dark
.
Text
--text-font
--text-color
--text-font-size
--text-field-placeholder
--cursor-on-color
--cursor-off-color
--text-field-background-color
--text-field-hint-color
--enable-text-field-hints
Suggestions
--list-color
--list-item-color--hover
--list-item-color--selected
--list-item-color--selected--hover
--list-item-height
--list-max-height
--icon-background-color
--scroller-color
--scroller-handle-color
--search-highlight-color
--enable-suggestions
--enable-suggestion-icons
--enable-suggestion-values
--enable-search-highlight
General colors
--accent-color
Icon colors
--icon-color-blank
--icon-color-dark
--icon-color-editor
--icon-color-enum
--icon-color-bool
--icon-color-prefab
--icon-color-gameobject
--icon-color-component
--icon-color-scriptableobject
Common selectors
Any of these can be modified to your liking. Do note that some modifications may require you to override some of Unity's own selectors. Again, we recommend reading up on their documentation.
Main element
.command-element
.command-element--hidden
Text field
.command-text-field
.command-text-field__hint
.cursor-on
.cursor-off
Suggestion list
.suggestion-list
.suggestion-list--hidden
.suggestion-list__item
.suggestion-list__item__label
.suggestion-list__item__value
.suggestion-list__item__icon
.suggestion-list__scroller
Debug window
.window
.window__container
.window__container__text
.window__container__button
.window__container__scroller
.window__title-bar
.window__title-bar__text
.window__title-bar__button
.window__resize-handle
Last updated