# Quickstart

## What's it all about?

Methods and properties can be turned into executable commands that are accessible directly within the editor, and within your application. Enhance your workflow in the editor, and debug your games with ease.

## Enter your first command <a href="#enter-your-first-command" id="enter-your-first-command"></a>

Try it out immediately after importing, by pressing **F1** in the editor.\
The command field will show up in the console window, where you can type in commands. Try inputting `log "Hello World!"`.

Now try to enter play-mode and press **F1** in-game. The command field should show up and function in the exact same way. Exclusive runtime commands should also be available now, such as `screen.fps`. For a full list of built-in commands, [see the included commands](/documentation/included-commands)

{% hint style="info" %}
**Note**

Shortcuts can be changed for both the editor and runtime command field. Navigate to project settings to set them to your liking. You can also type `open.settings` in the command field, to quickly open the settings window.
{% endhint %}


# Syntax

With Ghost Commands, certain rules must be followed in order to succesfully execute commands.

* Input always start with the name of the command, followed by it's arguments.
* Arguments are separated with an empty space, unless they are enclosed in containers or quotations.
* Arguments can have multiple values, which are separated by a comma. Such as `Vector3`.
* Custom type arguments should be enclosed in parantheses.
* Arrays are enclosed in square brackets.

So let's break it down.


# Command syntax

The first rule is, that any input must begin with the name of the command. Let's simply print a message to the console.\
Initially, we would type: `print`. Following this, we need to specify the message we wish to display. As the command anticipates a `string` argument, we could input: `print Hello`.

For a simple message, this would be sufficient. However, since arguments are separated by an empty space, the command would become invalid if we were to type: `print Hello World`.\
This is because we have technically supplied the print command with two distinct arguments when it only accepts one. In such instances, we simply enclose our argument in quotation marks: `print "Hello World"`.

{% hint style="info" %}
**Note**

It is also possible to use `'` to enclose strings.
{% endhint %}


# Arguments with multiple values

Types can consist of multiple values, such as `Vector3`. In code we'd make a `Vector3` like so: `new Vector3(5, 10, 20)`. Whereas in the command field, we would specify a `Vector3` like this: `(5, 10, 20)`. Alternatively, you could omit the parentheses, but in doing so, you must ensure there are no empty spaces between the values.

Another more advanced example would be an array of types. Let's pretend the `choose` command anticipated an array of `Vector3`, it would look like this: `choose [(0, 0, 0), (-50, -10, 12), (10, 20, 30)]`.

{% hint style="info" %}
**Note**

Nested arrays are also supported.
{% endhint %}


# Custom commands

The `[Command]` attribute turns any method or property into a command, and will become available for execution in the command field upon recompilation.

## How to create a command <a href="#how-to-create-a-command" id="how-to-create-a-command"></a>

{% tabs %}
{% tab title="Static example" %}

```csharp
using UnityEngine;
using Ghostlike.Commands;

public static class NumberCommands
{
    [Command]
    public static int RandomNumber(int from, int to)
    {
        return Random.Range(from, to);
    }
}
```

The method can be executed immediately by typing: `randomnumber 0 10` in the command field.
{% endtab %}

{% tab title="Non-static example" %}

```csharp
using UnityEngine;
using Ghostlike.Commands;

public class Player : MonoBehaviour
{
    [SerializeField] private float maxHealth;
    private float currentHealth;

    [Command]
    public int Heal(int amount)
    {
        currentHealth += amount;
        currentHealth = Mathf.Clamp(currentHealth, 0, maxHealth);
    }
}
```

Contrary to static methods, a non-static method requires an instance in order to be invoked.

Instances are found automatically with `Object.FindObjectsByType`. This means there is no additional setup required on your part.

Executing the command like this: `heal 10` will heal all instances of `Player` found in the scene. A name can be specified in order to execute the command only on instances with the specified name. It can be specified at the end of the input, prefixed with `@`. Like so: `heal 10 @MyPlayer`.
{% endtab %}
{% endtabs %}


# Commands

In this section, we go over even more ways to set up commands. Including name aliases, overloads and optional parameters. As mentioned before, the \[Command] attribute is used on any method or property


# Static commands

## Adding static commands <a href="#adding-static-commands" id="adding-static-commands"></a>

The simplest way to add a command is with static methods, as there is no additional steps required. Simply put the `[Command]` attribute on the method, and you're all set!

```csharp
[Command]
public static void SayHello()
{   
    Debug.Log("Hello world!");
}
```

By default, the method name is used for the command, unless other names have been specified. If multiple names are assigned, they serve as aliases for the same command, overwriting the original method name.

```csharp
[Command("Test", "Hello", "Debug")]
public static void SayHello()
{
    Debug.Log("Hello world!");
}
```

Commands can also take parameters just like any regular method.

```csharp
[Command]
public static int Multiply(int a, int b)
{
    return a * b;
}
```

Returning a value in your method will automatically log it to the console.


# Non-static commands

## Adding non-static commands <a href="#non-static-commands" id="non-static-commands"></a>

Non-static methods or properties require an instance in order to be executed. Instances are found automatically behind the scenes, which means there is no additional setup required on your part.

```csharp
public class Player : MonoBehaviour
{
    private float currentHealth;

    [Command]
    public int Health
    {
        get => currentHealth;
        set => currentHealth = value;
    }
}
```

Typing `health 10` will execute on all instances of `Player` found in the scene.

Additionally, a name can be specified at the end of the input prefixed with `@`. Doing so will execute the command only on instances with the specified name.

The name is always specified at the end of the last required parameter. So for example, if we want to just print the value of a property instead of setting it, we could type: `health @MyPlayer`.


# Dynamic commands

If you want even more control over your commands, they can also be added and removed at runtime by accessing the `CommandExecutor` class directly.

## Adding commands at runtime <a href="#adding-commands-at-runtime" id="adding-commands-at-runtime"></a>

Any delegate can be turned into a command using `CommandExecutor.AddCommand`. The method simply requires a name for the command, along with a delegate.

{% tabs %}
{% tab title="Action delegate" %}

```csharp
private void Start()
{
    // The method doesn't return anything, so we'll create an Action.
    CommandExecutor.AddCommand("hello", new Action<string>(Hello));
}

private void Hello(string message)
{
    Debug.Log(message);
}
```

{% endtab %}

{% tab title="Func delegate" %}

```csharp
private void Start()
{
    // The method returns a value, so we'll create Func in this case.
    CommandExecutor.AddCommand("multiply", new Func<int, int, int>(Multiply));
}

private int Multiply(int a, int b)
{
    return a * b;
}
```

{% endtab %}

{% tab title="Lambda expression" %}

```csharp
private void Start()
{
    // Alternatively you could create the delegate with a lambda expression. 
    CommandExecutor.AddCommand("hello", new Action<string>((string message) =>
    {
        Debug.Log(message);
    }));
}
```

{% endtab %}
{% endtabs %}

## Removing commands at runtime

Commands can also be removed at runtime. Even those that were created using the `[Command]` attribute. To do so, use `CommandExecutor.RemoveCommand`. The example below shows a great way to keep the player engaged for longer.

```csharp
CommandExecutor.RemoveCommand("quit");
```

{% hint style="info" %}
Note

If you've removed commands that were made using the `[Command]` attribute, such as any built-in command, you can restore all of them with `CommandExecutor.Scan()`.
{% endhint %}


# Overloads

## Overloaded commands <a href="#overloaded-commands" id="overloaded-commands"></a>

Multiple commands can share the same name, provided that either the parameter types or number vary.

```csharp
[Command]
public static void LoadScene(string name)
{
    SceneManager.LoadScene(name);
}

[Command]
public static void LoadScene(int buildIndex)
{
    SceneManager.LoadScene(buildIndex);
}
```

Based on the input when typing the argument, the command field will automatically select the first matching command.

{% hint style="info" %}
**Type Ambiguety**

`int` parameters are prioritized higher than `float` parameters. To differentiate between them, you can put a decimal on your `float` values. The same principle applies to vectors.
{% endhint %}


# Parameters

## Parameter types <a href="#parameter-types" id="parameter-types"></a>

All primitive types and basic Unity value types such as `Vector3` and `Color` are supported out of the box. Also, most types derived from `UnityEngine.Object` can be used as parameters.

This means types like `GameObject`, `ScriptableObject`, `MonoBehaviour` can be used as parameters without any setup.\
When typing the parameter in the command field, we specify the name of the object we want to reference. The object is then found automatically with the given name.

It's also possible to use prefab game objects as parameters. To do this, we can place a `[Prefab]` attribute in front of our parameter. Like so:

```csharp
[Command]
public string SetPrefabTag([Prefab]GameObject prefab, string tag)
{
    if (prefab != null)
        prefab.tag = tag;
}
```

{% hint style="info" %}
**Editor commands**

When making editor commands, asset types like `MonoScript`, `StyleSheet`, `Shader` etc. can also be used as parameters. The assets are found by name, in the asset database.
{% endhint %}

{% hint style="info" %}
**Custom types**

Custom types are also supported as parameters. See the [converters section](/documentation/converters) for more details about custom types.
{% endhint %}

## Optional parameters

```csharp
[Command]
public void Damage(int amount = 1)
{
    health -= amount;
}
```

Optional parameter values are also supported. You can simply define a method with default optional parameters. Given the example above, if you were to execute the command without any argument, it would default to dealing 1 damage.


# Additional attributes

## Additional attributes

{% tabs %}
{% tab title="Description" %}

```csharp
[Command]
[Description("Gives 5000 coins to the player")]
public static void Motherlode()
{
    coins += 5000;
}
```

Commands can have a description added to them with the `[Description]` attribute.\
To see the description of a command, type `help <command name>` in the command field.
{% endtab %}

{% tab title="Prefix" %}

```csharp
[Prefix("score")]
public static class ScoreManager
{
    [Command]
    public static int Current { get; set; }

    [Command]
    public static void Reset()
    {
        Current = 0;
    }
}
```

Commands can be organized together by using the `[Prefix]` attribute on a class, which then groups all the commands in that class under the same prefix.\
It can be used on classes, methods or properties.

The above example would result in the commands looking like this in the command field:\ <img src="/files/NvnN4EmjO45zcKiqGWtH" alt="" data-size="original">

{% hint style="info" %}
The prefix character can be changed in project settings. See the [settings section](/documentation/settings) for more details.
{% endhint %}
{% endtab %}

{% tab title="Editor Only" %}

```csharp
[Command]
[EditorOnly]
public static void RefreshAssets()
{
    AssetDatabase.SaveAssets();
    AssetDatabase.Refresh();
}
```

Commands can be constrained to only show up in edit-mode, and not be shown in play-mode, with the `[EditorOnly]` attribute.\
It can be used on classes, methods or properties.
{% endtab %}

{% tab title="Runtime Only" %}

```csharp
[Command]
[RuntimeOnly]
public static void HealPlayers(int amount)
{
    Player[] players = FindObjectsByType<Player>(FindObjectsSortMode.None);

    foreach (var player in players)
    {
        player.Health += amount;
    }
}
```

Commands can be constrained to only show up in play-mode, and not be shown in edit-mode, with the `[RuntimeOnly]` attribute.\
It can be used on classes, methods or properties.
{% endtab %}
{% endtabs %}


# Suggestions

When typing in the command field, a list will appear with suggestions based on your input. These work both for the name of the command you type at the start, as well as the parameters for the command.


# Suggestion attributes

## Custom suggestion attributes

Most parameter types such as `enum`, `bool`, `Color` and derivatives from `UnityEngine.Object` already comes with suggestions. However, it's also possible to define your own custom suggestions that you can specify on individual parameters.

To define your own suggestions, make a new class that inherits from `SuggestionAttribute`:

```csharp
public class PositionAttribute : SuggestionAttribute
{
    public override IEnumerable<string> Get()
    {
        string[] positions = { "(0,0,0)", "(20,10,20)", "(5,100,5)" };
        return positions;
    }
}
```

Then to see the suggestions on a parameter, put the attribute on the parameter in the method.

```csharp
public class Player : MonoBehaviour
{
    [Command]
    public void Teleport([Position] Vector3 position)
    {
        transform.position = position;
    }
}
```

## Built-in suggestion attributes[​](https://ghostlike.dk/docs/suggestions#built-in-suggestion-attributes) <a href="#built-in-suggestion-attributes" id="built-in-suggestion-attributes"></a>

* `[SceneName]` - List of all scenes.
* `[CommandName]` - List of all loaded commands.


# Suggestor methods

## Custom suggestor methods[​](https://ghostlike.dk/docs/suggestions#custom-suggestor-methods) <a href="#custom-suggestor-methods" id="custom-suggestor-methods"></a>

To define suggestions based on an entire type (or derived types), the `[Suggestor]` attribute can be placed on a static method that returns `string[]`, and takes a single `CommandInfo.Parameter` parameter.

```csharp
[Suggestor(typeof(Vector3))]
public static string[] VectorSuggestor(CommandInfo.Parameter parameter)
{
    return new string[]
    {
        "(0, 0, 0)",
        "(1, 1, 1)",
        "(1, 0, 0)",
        "(0, 1, 0)",
        "(0, 0, 1)"
    }
}
```

Now whenever the user reaches a `Vector3` parameter, these suggestions will be shown in the suggestion list.

{% hint style="info" %}

#### Note

The reason the method takes a `CommandInfo.Parameter`, is to get more information about the current parameter we are making suggestions for, if needed. Though in most cases, returning a simple string array should be sufficient.
{% endhint %}

{% hint style="info" %}

#### Custom icons

Suggestion icons can be customized with custom textures and colors. Read more about that in the [customization section](/documentation/customization).
{% endhint %}


# Converters

Ghost Commands comes with built-in support for primitive types as well as popular Unity types such as Vector3, Quaternion, Color and more. However, there may arise instances where you'd want to extend


# Custom parameter types

To demonstrate how a custom type can be supported, we are going to create a converter for an arbitrary class.

```csharp
public class Person
{
    public readonly string name;
    public readonly int age;

    public Person(string name, int age)
    {
        this.name = name;
        this.age = age;
    }
}
```

## Converter methods

The way converters work, is by creating a method that takes in a `string` and return an actual value. Converter methods must return a non-primitive type, and they must only take **1** parameter of type `ArgumentReader`.

To mark a method as a converter method, simply place a `[Converter]` attribute on it.

```cs
[Converter]
public static Person PersonTypeConverter(ArgumentReader reader)
{
    
}
```

{% hint style="info" %}
**Note**

The method doesn't have to be located within the type we're attempting to convert. These methods can be stored anywhere you prefer
{% endhint %}


# Using the ArgumentReader

The `ArgumentReader` abstracts the argument, and makes it easier to retrieve information from it. The information can be retrieved and interpreted from within our method to create the actual `Person` instance we want to return.\
Because we know the constructor takes a `string` and an `int`, we can expect the provided argument to be constructed in a way that allows us to retrieve those values.

```cs
[Converter]
public static Person PersonTypeConverter(ArgumentReader reader)
{
    string name = reader.Read<string>();
    int age = reader.Read<int>();

    return new Person(name, age);
}
```

Each component of the argument is being read in order. This means that once a component has been read, it can not be read again. It simply functions as a queue. This makes it so you do not have to specify any indices, but it also means you have to store the values in order.\
With the simple method, We can now support parameters of type `Person`. The input string could look like this: `hello (Bob, 52)`, which would result in a new instance of `Person`, with `name` set to Bob, and `age` set to 52.&#x20;

{% hint style="info" %}
**Note**

When utilizing the `Read()` method, the `ArgumentReader` will recursively attempt to convert the given argument into the specified type. If the type is primitive, it already knows how to convert it, as it is supported by default. If a custom type is specified however, it'll convert it using a custom converter method instead.&#x20;
{% endhint %}


# Multiple ways to interpret an argument

By getting the amount of values with `reader.Length`, we can support multiple ways to interpret an argument. An example would be how a `UnityEngine.Color` can be interpreted both from a hex value and an RGB value.

```cs
[Converter]
public static Color ColorConverter(ArgumentReader reader)
{
    float r, g, b, a;

    switch (reader.Length)
    {
        // In case the amount of components was 1
        case 1:
            if (reader.IsNumeric())
            {
                // If the component is a number, return an RGB color with this value
                float value = reader.Read<float>() / 255;
                return new(value, value, value);
            }
            else
            {
                // If the component can be read as a string, try to return a color based on a hex value
                string hex = reader.Read<string>();
                if (ColorUtility.TryParseHtmlString(hex, out Color hexColor))
                    return hexColor;
                else
                    throw new Exception($"Invalid hex value: '{hex}'.");
            }

        // In case the amount of components was 3
        case 3:
            // Return an RGB value using the 3 numbers
            r = reader.Read<float>();
            g = reader.Read<float>();
            b = reader.Read<float>();
            return new(r, g, b);

        // In case the amount of components was 4
        case 4:
            // Return an RGBA value using the 4 numbers
            r = reader.Read<float>();
            g = reader.Read<float>();
            b = reader.Read<float>();
            a = reader.Read<float>();
            return new(r, g, b, a);
    }

    // If more or less components was provided, we notify of the error
    throw new Exception($"Could not retrieve color from input: {reader.Source}.");
}
```

{% hint style="info" %}
**Note**

This converter is built-in, and is purely used as an example. You wouldn't need to create this in order to support parameters of type `UnityEngine.Color`.
{% endhint %}


# Processors

We expect the input to follow the general syntax, but in some cases we might want to alter what is being submitted to support custom functionality.


# Creating a processor

Create a static method that returns a `string` and mark it as a processor using the `[Processor]` attribute.\
This example removes exclamation marks from the input. In case you want to prevent aggressive commands.

```csharp
[Processor]
public static string RemoveExclamationProcessor(string input)
{
    return input.Replace("!", string.Empty);
}
```

{% hint style="warning" %}
**Caution**

You may not wanna go overboard with processors, as it could lead to unexpected behaviour if not handled with caution. Remember to make sure the final string is still executable after being modified.
{% endhint %}


# Setting priorities

As multiple processors can operate concurrently, unexpected results can occur if we do not specify the order at which they are executed. To designate the priority of a processor method, assign it a value to the attribute. Lower values indicate higher priority and are executed first.

```csharp
[Processor(100)]
public static string CheatCodeProcessor(string input) (...)
```


# Cheat codes example

Maybe we want to add cheat codes to our game, either for ourselves to test features quickly, or for the players to have fun with. Processors are perfect for this, and you can probably already guess why.

```csharp
[Processor]
public static string CheatCodeProcessor(string input)
{
    switch (input.ToLower())
    {
        case "cheese":
            return "money.add 5000";

        case "godmode":
            return "player.health.invincible True";

        case "noclip":
            return "player.movement.noclip True";

        // If input doesn't match any cheatcode, we cancel the input
        // to prevent other commands from being executed.
        default:
            return string.Empty;
    }
}
```

As you can see, we simply check if the input matches any of our cheat codes, and if it does, we replace the entire input string with an actual command.

{% hint style="info" %}
**Note**

By default, Ghost Commands are only available inside the editor and inside a Development Build. If you want your players to access commands in a final build, navigate to project settings and turn off the *Development Only* toggle. You might also wanna turn off suggestions. Read more in the [settings section](/documentation/settings), and [custom styles section](/documentation/customization).
{% endhint %}


# Macros

A macro acts as shorthand for longer inputs. You could for example shorten a command with multiple parameters, into a concise macro that is faster to write.

## Creating macros[​](https://ghostlike.dk/docs/macros#creating-macros) <a href="#creating-macros" id="creating-macros"></a>

Create a macro with the `macro.add` command, followed by the input you want to substitute.\
Typing `macro.add loadmain 'scene.load MainScene'` results in a macro called #loadmain.\
When the input gets processed, #loadmain will automatically be replaced with `scene.load MainScene`.

{% hint style="info" %}
**Note**

Alternatively, macros can be created by typing #name, followed by the input.\
For example: `#loadmain 'scene.load MainScene'`
{% endhint %}

<details>

<summary>More macro usages</summary>

Let's say we have added a macro with `macro.add loadmain 'scene.load MainScene'`

```css
When typing '#loadmain'
It replaces your input with 'scene.load MainScene' 
```

Now let's say we add a macro like this: `macro.add emerald (0,208,98)`

```css
When typing 'fog.color #emerald'
It replaces your input with 'fog.color (0,208,98)'
```

Which makes your fog an objectively beautiful emerald green.

</details>

## Viewing current macros[​](https://ghostlike.dk/docs/macros#viewing-current-macros) <a href="#viewing-current-macros" id="viewing-current-macros"></a>

For an overview of all macros currently registered, simply execute the `macro.getall` command.

## Removing macros[​](https://ghostlike.dk/docs/macros#removing-macros) <a href="#removing-macros" id="removing-macros"></a>

To remove a macro, type `macro.remove` followed by the name of the macro, excluding the #.\
`macro.remove loadmain`\
You can also remove all registered macros with `macro.removeall`


# Settings

In this section we will go over settings that alter functionality and preferences such as keybinds.\
If you want to personalize the look and feel of the UI, see the [customization section.](/documentation/customization)

## General settings[​](https://ghostlike.dk/docs/settings#general-settings) <a href="#general-settings" id="general-settings"></a>

* **Include Assemblies** is a list to define assemblies that are scanned for commands and other attributes related to Ghost Commands.
* **Development Only** toggles whether or not to include commands in a non-development build.
* **Default Commands** toggles whether or not to include the built-in [default commands](/documentation/included-commands).
* **Prefix Separator** defines the character used for prefixes.
* **Auto Prefix** automatically adds prefixes to non-static commands based on their declaring class name.
* **Force Case** is used to force a lowercase or uppercase on all command names and prefixes, regardless of how they were written in the code.
* **Max History Length** defines the max amount of entries when navigating command history.

## Suggestion settings[​](https://ghostlike.dk/docs/settings#suggestion-settings) <a href="#suggestion-settings" id="suggestion-settings"></a>

* **Max Entries** specifies the maximum amount of suggestions being shown.
* **Max Fuzzy Distance** specifies the accuracy of the search algorithm. Higher values result in less accurate searches, but allow more typos.

## Runtime settings[​](https://ghostlike.dk/docs/settings#runtime-settings) <a href="#runtime-settings" id="runtime-settings"></a>

* **Toggle Key** is the key used for opening the command field in play-mode.
* **Auto Disable Input** handles automatically disabling input maps. This is to prevent the player from moving while typing in the command field. ***(This is only available when using the new input system)***
* **(Output) Open automatically** opens the output window automatically whenever there is a new output entry.
* **Custom Style Sheets** allow you to the look and feel of the UI. see the [customization section](/documentation/customization) for more information.

## Editor settings[​](https://ghostlike.dk/docs/settings#editor-settings) <a href="#editor-settings" id="editor-settings"></a>

* **Window** specifies which window the command field appears on.
* **Custom Style Sheets** allow you to the look and feel of the UI. see the [customization section](/documentation/customization) for more information.
* The **Edit Shortcut** button opens the unity shortcut window, where you can rebind the shortcut for opening the command field inside the editor.


# 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](https://docs.unity3d.com/Manual/UIE-about-uss.html) 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[​](https://ghostlike.dk/docs/custom-styles#applying-the-style-sheet) <a href="#applying-the-style-sheet" id="applying-the-style-sheet"></a>

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.

```css
: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;
    (...)
}
```

{% hint style="info" %}
**Note**

Variable properties must be prefixed with `--`. This is a general rule in style sheets. So remember to use that for your variables!
{% endhint %}

You can also override specific class selectors to change any property within them.

```css
.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[​](https://ghostlike.dk/docs/custom-styles#guide-snippets) <a href="#guide-snippets" id="guide-snippets"></a>

<details>

<summary>Change font</summary>

```css
:root{
    --text-font: url("/Assets/Fonts/SpookyFont-Regular.ttf");
}
```

</details>

<details>

<summary>Change accent color</summary>

```css
:root{
    --accent-color: rgb(255, 0, 0);
}
```

</details>

<details>

<summary>Change search highlight color</summary>

```css
:root{
    --search-highlight-color: rgb(215, 180, 50);
}
```

</details>

<details>

<summary>Change placeholder text</summary>

```css
:root{
    --text-field-placeholder: "Input goes here..."; /* Instead of the default: Enter command... */
}
```

</details>

<details>

<summary>Disable suggestions</summary>

```css
:root{
    --enable-suggestions: false;
}
```

</details>

<details>

<summary>Disable suggestion icons</summary>

```css
:root{
    --enable-suggestion-icons: false;
}
```

</details>

<details>

<summary>Disable suggestion values</summary>

```css
:root{
    --enable-suggestion-values: false;
}
```

</details>

<details>

<summary>Disable search highlighting</summary>

```css
:root{
    --enable-search-highlight: false;
}
```

</details>

<details>

<summary>Disable text field hints</summary>

```css
:root{
    --enable-text-field-hints: false;
}
```

</details>

<details>

<summary>Disable animation</summary>

```css
.command-element{
    transition-property: none;
}

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

</details>

## How to set custom icons[​](https://ghostlike.dk/docs/custom-styles#how-to-set-custom-icons) <a href="#how-to-set-custom-icons" id="how-to-set-custom-icons"></a>

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;
}
```

{% hint style="info" %}
**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.
{% endhint %}

Setting icons for a prefix is just as simple. We simply replace `name` with `prefix` in the selector.

```css
.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:

```css
.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:

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

{% hint style="info" %}
**Naming**

Selectors **must** be in lower-case in order for your custom icons to applied.
{% endhint %}

{% hint style="info" %}
**Styling**

We recommend using white textures, as changing the color via style sheets, and respecting the general `--accent-color` is easier that way.
{% endhint %}

## Common variables[​](https://ghostlike.dk/docs/custom-styles#common-variables) <a href="#common-variables" id="common-variables"></a>

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[​](https://ghostlike.dk/docs/custom-styles#text) <a href="#text" id="text"></a>

* `--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[​](https://ghostlike.dk/docs/custom-styles#suggestions) <a href="#suggestions" id="suggestions"></a>

* `--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[​](https://ghostlike.dk/docs/custom-styles#general-colors) <a href="#general-colors" id="general-colors"></a>

* `--accent-color`

### Icon colors[​](https://ghostlike.dk/docs/custom-styles#icon-colors) <a href="#icon-colors" id="icon-colors"></a>

* `--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[​](https://ghostlike.dk/docs/custom-styles#common-selectors) <a href="#common-selectors" id="common-selectors"></a>

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](https://docs.unity3d.com/Manual/UIE-about-uss.html).

### Main element[​](https://ghostlike.dk/docs/custom-styles#main-element) <a href="#main-element" id="main-element"></a>

* `.command-element`
* `.command-element--hidden`

### Text field[​](https://ghostlike.dk/docs/custom-styles#text-field) <a href="#text-field" id="text-field"></a>

* `.command-text-field`
* `.command-text-field__hint`
* `.cursor-on`
* `.cursor-off`

### Suggestion list[​](https://ghostlike.dk/docs/custom-styles#suggestion-list) <a href="#suggestion-list" id="suggestion-list"></a>

* `.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[​](https://ghostlike.dk/docs/custom-styles#debug-window) <a href="#debug-window" id="debug-window"></a>

* `.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`


# Included Commands

### Core Commands

Assortment of essential commands.

| Command     | Description                                     |
| ----------- | ----------------------------------------------- |
| `TimeScale` | Sets the scale at which time passes.            |
| `Print`     | Writes a message to the console.                |
| `Clear`     | Clears the console.                             |
| `Help`      | Gives a list of all current commands.           |
| `Help`      | Describes the specified command.                |
| `Quit`      | Quits the application immediately. (build only) |

### Scene Commands

Commands for managing and interacting with scenes in Unity.

| Command                 | Description                                             |
| ----------------------- | ------------------------------------------------------- |
| `Scene.Load`            | Loads a scene from a specified name.                    |
| `Scene.Reload`          | Reloads the currently loaded scene.                     |
| `Scene.AddToBuild`      | Adds the specified scene to build settings.             |
| `Scene.AddToBuild`      | Adds the currently active scene to the build settings.  |
| `Scene.RemoveFromBuild` | Removes the specified scene from build settings.        |
| `Scene.RemoveFromBuild` | Removes the currently active scene from build settings. |
| `Scene.GetAll`          | Prints the names of all scenes.                         |

### Bind Commands

Bind commands are used to create and manage keybinds in-game, which persist across game sessions.

| Command     | Description                                       |
| ----------- | ------------------------------------------------- |
| `Bind`      | Binds the specified command to the specified key. |
| `Unbind`    | Unbinds any command from the specified key.       |
| `UnbindAll` | Unbinds any command from all bound keys.          |

### Create Commands

Commands for quickly generating standard assets like scenes, scripts, and prefabs.

| Command             | Description                                                                 |
| ------------------- | --------------------------------------------------------------------------- |
| `Create.Scene`      | Creates a new Scene in the current Project folder.                          |
| `Create.Folder`     | Puts selected assets into a new folder.                                     |
| `Create.Script`     | Creates a new script in the current Project folder.                         |
| `Create.Script`     | Creates a new script within given namespace, in the current Project folder. |
| `Create.Material`   | Creates a new Material in the current Project folder.                       |
| `Create.UXML`       | Creates a new UI Document in the current Project folder.                    |
| `Create.Prefab`     | Creates a new prefab in the current Project folder.                         |
| `Create.GameObject` | Creates a new GameObject in the scene.                                      |

### Name Commands

Name commands provide functionality to rename assets in your project, and objects in your hierarchy.

| Command        | Description                                           |
| -------------- | ----------------------------------------------------- |
| `Name.Prefix`  | Renames selected assets to have a prefix.             |
| `Name.Suffix`  | Renames selected assets to have a suffix.             |
| `Name.Rename`  | Renames selected assets.                              |
| `Name.Remove`  | Remove matching substrings from selected asset names. |
| `Name.Replace` | Replace matching substrings in selected asset names.  |

### Object Commands

Commands for modifying and managing game objects in the scene.

| Command            | Description                                                                       |
| ------------------ | --------------------------------------------------------------------------------- |
| `Object.Position`  | Sets the position of the specified game object.                                   |
| `Object.Rotation`  | Sets the rotation of the specified game object.                                   |
| `Object.Scale`     | Sets the scale of the specified game object.                                      |
| `Object.Transform` | Sets the position, rotation and scale of the specified game object.               |
| `Object.Reset`     | Resets the position, rotation and scale of the specified game object.             |
| `Object.Spawn`     | Instantiates the specified prefab in the scene, at an optional position.          |
| `Object.Destroy`   | Destroys the specified game object.                                               |
| `Object.Clone`     | Duplicates an already existing game object in the scene, at an optional position. |
| `Object.LookAt`    | Rotates the specified game object to face the target game object.                 |

### Ambient Commands

Commands for configuring ambient lighting settings.

| Command                | Description                                               |
| ---------------------- | --------------------------------------------------------- |
| `Ambient.Color`        | Sets the color of flat ambient light.                     |
| `Ambient.SkyColor`     | Sets the color of ambient light coming from above.        |
| `Ambient.GroundColor`  | Sets the color of ambient light coming from below.        |
| `Ambient.EquatorColor` | Sets the color of ambient light coming from the sides.    |
| `Ambient.Intensity`    | Sets how much the ambient light source affects the scene. |
| `Ambient.Source`       | Sets the ambient lighting mode (skybox, gradient, color)  |

### Build Commands

Commands for building your program for various platforms.

| Command         | Description                                             |
| --------------- | ------------------------------------------------------- |
| `Build.Windows` | Builds a Windows 64-bit executable with the given name. |
| `Build.Linux`   | Builds a Linux executable with the given name.          |
| `Build.Android` | Builds an Android APK with the given name.              |
| `Build.iOS`     | Builds an iOS application with the given name.          |
| `Build.OSX`     | Builds an macOS application with the given name.        |

### Camera Commands

Camera commands manage various properties and actions related to the main camera.

| Command        | Description                                        |
| -------------- | -------------------------------------------------- |
| `Camera.FOV`   | Changes the Field of View of the main camera.      |
| `Camera.Align` | Aligns the main camera with the scene-view camera. |

### Copy Commands

Commands for helping with copying game object variables to clipboard.

| Command          | Description                                                                        |
| ---------------- | ---------------------------------------------------------------------------------- |
| `Copy.Position`  | Copies the position of the specified game object to clipboard.                     |
| `Copy.Rotation`  | Copies the rotation of the specified game object to clipboard.                     |
| `Copy.Scale`     | Copies the scale of the specified game object to clipboard.                        |
| `Copy.Transform` | Copies the position, rotation and scale of the specified game object to clipboard. |

### Fog Commands

Fog commands to adjust different fog settings.

| Command             | Description                            |
| ------------------- | -------------------------------------- |
| `Fog.Enabled`       | Toggles whether fog is enabled or not. |
| `Fog.StartDistance` | Changes the starting distance of fog.  |
| `Fog.EndDistance`   | Changes the ending distance of fog.    |
| `Fog.Density`       | Changes the density of fog.            |
| `Fog.Color`         | Changes color of the fog.              |
| `Fog.Mode`          | Changes the fog calculation mode.      |

### Layout Commands

Commands for loading and saving Unity editor layouts.

| Command       | Description                         |
| ------------- | ----------------------------------- |
| `Layout.Load` | Loads a layout with the given name. |

### Open Commands

Commands to open various types of assets in the Unity Editor.

| Command          | Description                              |
| ---------------- | ---------------------------------------- |
| `Open.Script`    | Opens the specified script.              |
| `Open.USS`       | Opens the specified style sheet.         |
| `Open.UXML`      | Opens the specified UI Document.         |
| `Open.Shader`    | Opens the specified shader.              |
| `Open.Animation` | Opens the specified animation clip.      |
| `Open.Animator`  | Opens the specified animator controller. |
| `Open.Prefab`    | Opens the specified prefab.              |

### Physics Commands

Commands for modifying and managing physics-related properties.

| Command                  | Description                                       |
| ------------------------ | ------------------------------------------------- |
| `Physics.Gravity`        | Sets the gravity (Y-axis).                        |
| `Physics.Timestep`       | Sets the interval at which physics updates occur. |
| `Physics.SimulationMode` | Sets the physics simulation mode.                 |

### Player Prefs Commands

Commands for managing PlayerPrefs data.

| Command                 | Description                                 |
| ----------------------- | ------------------------------------------- |
| `PlayerPrefs.SetInt`    | Sets an int value for the given key.        |
| `PlayerPrefs.SetFloat`  | Sets a float value for the given key.       |
| `PlayerPrefs.SetString` | Sets a string value for the given key.      |
| `PlayerPrefs.GetInt`    | Gets an integer value for the given key.    |
| `PlayerPrefs.GetFloat`  | Gets a float value for the given key.       |
| `PlayerPrefs.GetString` | Gets a string value for the given key.      |
| `PlayerPrefs.DeleteKey` | Deletes the specified key from PlayerPrefs. |
| `PlayerPrefs.ClearAll`  | Clears all PlayerPrefs data.                |

### Player Settings Commands

Commands for modifying player build settings.

| Command                     | Description                                  |
| --------------------------- | -------------------------------------------- |
| `Settings.ScriptingBackend` | Sets the scripting backend (Mono or IL2CPP). |

### Screen Commands

Commands for managing various display settings for the application.

| Command             | Description                                    |
| ------------------- | ---------------------------------------------- |
| `Screen.FPS`        | Sets the target framerate.                     |
| `Screen.VSync`      | Sets whether VSync should be enabled.          |
| `Screen.Fullscreen` | Sets whether the application is in fullscreen. |
| `Screen.Resolution` | Sets the resolution of the application.        |


