---
title: Run custom commands in the Unity CLI
product: Unity command-line interface (CLI)
canonical: https://docs.unity.com/en-us/unity-cli/command-name-conventions/run-command-cli
last_updated: 2026-11-06
generated_at: 2026-11-11T11:49:35.868Z
locale: en-us
---

# Run custom commands in the Unity CLI

> Use unity command to run custom commands and Pipeline package commands, list command group contents, and learn how the Unity CLI resolves commands.

Use `unity command` to run commands defined with the `[CliCommand]` attribute, including Pipeline package commands and your own custom commands.

> **Note:**
>
> For commands built into the Unity CLI, such as `unity install` or `unity open`, refer to [Unity CLI reference](/unity-cli/reference.md).

## Run a command

To run a command from the Unity CLI, pass its group, its name, and any arguments to `unity command`:

```bash
unity command <group> <name> [args]
```

For example, the following command creates an Animator Controller with the `create_controller` command in the `animation.animator` group:

```bash
unity command animation.animator create_controller
```

Type the group as a single token, with dots between subgroups. For example, type `animation.animator`, not `animation animator`.

### Run a command by its ID

You can also run a command by its ID:

```bash
unity command <group>.<name> [args]
```

In an ID, the last dot-separated segment is the command name and everything before it is the group. For example, `unity command build.run` runs the `run` command in the `build` group.

### Run a command without its group

Every command belongs to a group, but in some cases you can leave the group out when you run the command.

### Run commands in the global group

Commands in the `global` group can run with or without the group name. For example, if the `global` group contains a `status` command, the following commands are equivalent:

```bash
unity command global status
unity command status
```

When you run a command without a group, the Unity CLI looks up the name in the `global` group first.

### Run a command with a unique name

If no other group has a command with the same name, you can run the command without its group. For example, if `create_controller` exists only in the `animation.animator` group, the following commands are equivalent:

```bash
unity command animation.animator create_controller
unity command create_controller
```

This shortcut only works for names that are unique across all groups. For example, `create` exists in both the `animation.clip` and `animation.timeline` groups, so you must include the group:

```bash
unity command animation.clip create
```

> **Tip:**
>
> In scripts and batch files, include the group even when the command name is unique. If someone later adds a command with the same name to another group, or to the `global` group, a command without its group might stop working or run a different command.

## List commands in a group

To list the contents of a group, pass only the group:

```bash
unity command animation           # Lists the contents of animation, such as subgroups
unity command animation.animator  # Lists the contents of animation.animator, such as commands
```

Groups have no default command, so passing only a group always lists its contents instead of running a command.

## How the Unity CLI resolves a command

The Unity CLI checks the first token after `unity command` in the following order:

1. If the token is a group and a command name follows it, the Unity CLI runs that command.
2. If the token is a group and nothing follows it, the Unity CLI lists the group's contents.
3. If the token is a command ID, the Unity CLI runs that command.
4. If the token is the name of a command in the `global` group, the Unity CLI runs that command.
5. If the token isn't in the global group and is the name of a command that exists in only one group, the Unity CLI runs that command.

If the token doesn't match any of these cases, the Unity CLI returns an error. A single token that matches a group always lists that group, even if a command ID has the same spelling. For example, if the `build` group has both a `build.target` subgroup and a `target` command:

```bash
unity command build.target  # Lists the build.target subgroup
unity command build target  # Runs the target command in the build group
```

## Additional resources

* [Use the Unity CLI](/unity-cli/use-unity-cli.md)
* [Unity CLI reference](/unity-cli/reference.md)
* [Install Pipeline package](/unity-cli/unity-pipeline/unity-pipeline-package.md)
