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.

:root{
    --text-font-size: 14px;
    --accent-color: rgb(220, 190, 50);
    --search-highlight-color: rgb(10, 120, 210);
    --cursor-on-color: white;
    --cursor-off-color: transparent;
    (...)
}

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.

.suggestion-list{
    [Here you can override any properties you'd like]
}

Specific guides are provided below to make it simpler for you to customize common properties.

Guide snippets

Change font
:root{
    --text-font: url("/Assets/Fonts/SpookyFont-Regular.ttf");
}
Change accent color
:root{
    --accent-color: rgb(255, 0, 0);
}
Change search highlight color
:root{
    --search-highlight-color: rgb(215, 180, 50);
}
Change placeholder text
:root{
    --text-field-placeholder: "Input goes here..."; /* Instead of the default: Enter command... */
}
Disable suggestions
:root{
    --enable-suggestions: false;
}
Disable suggestion icons
:root{
    --enable-suggestion-icons: false;
}
Disable suggestion values
:root{
    --enable-suggestion-values: false;
}
Disable search highlighting
:root{
    --enable-search-highlight: false;
}
Disable text field hints
:root{
    --enable-text-field-hints: false;
}
Disable animation
.command-element{
    transition-property: none;
}

.command-element--hidden{
    translate: 0px 0px;
}

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:

.command-icon__name__[name goes here] {
    --unity-image: url("/Assets/Icons/MyIcon.png");
    --unity-image-tint-color: white;
}

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.

.command-icon__prefix__[prefix goes here] {
    --unity-image: url("/Assets/Icons/CoolPrefix.png");
    --unity-image-tint-color: blue;
}

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:

.parameter-icon__type__[type name] {
    --unity-image: url("/Assets/Icons/JuicyParameter.png");
    --unity-image-tint-color: orange;
}

To set an icon based on a suggestion attribute, you would type:

.parameter-icon__attribute__[name of attribute] {
    --unity-image: url("/Assets/Icons/Ghost.png");
    --unity-image-tint-color: green;
}

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