# 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.md) 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pentafloat.com/documentation/commands/parameters.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
