# 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](https://docs.pentafloat.com/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.
