Skip to content
Back to skills

Unity Run

ASecurity

Use when running Unity from CLI for any purpose — builds, tests, method execution, asset imports. Handles Unity installation detection, batchmode execution, and log monitoring. Other unity-dev skills depend on this for CLI execution.

  • 8 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 13, 2026
ai-agentsbash

Works with

  • cli

Security analysis

A100/100

Scanned October 13, 2026

npx -y skills add DmitriyYukhanov/agent-plugins --skill unity-run --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Unity Run?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Unity Run
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/dmitriyyukhanov-unity-run-agent-plugins/badge)](https://www.skillsdirectory.com/skills/dmitriyyukhanov-unity-run-agent-plugins)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: unity-run
description: Use when running Unity from CLI for any purpose — builds, tests, method execution, asset imports. Handles Unity installation detection, batchmode execution, and log monitoring. Other unity-dev skills depend on this for CLI execution.
---

# Run Unity CLI

Execute Unity in batchmode from the command line. This skill handles finding the Unity installation and constructing the CLI command. Calling skills (tests, builds) provide the specific flags.

## Step 1: Find the Unity project

Starting from the current working directory, locate `ProjectSettings/ProjectVersion.txt` by walking up or using Glob. The directory containing `ProjectSettings/` is the project root.

If the user provides a project path explicitly, use that instead.

## Step 2: Detect Unity installation

Use the plugin's detection script:

Locate this installed `SKILL.md` through the current host's skill metadata or file tools. Resolve `../..` from its directory to get the absolute plugin root. Replace `<absolute-plugin-root>` below with that path and verify `scripts/find-unity.sh` exists. If the resource is unavailable, report the missing path and stop; do not assume a host environment variable supplies it.

```bash
UNITY_PATH=$("<absolute-plugin-root>/scripts/find-unity.sh" "<project-root>")
```

The script auto-detects Unity via Hub config, default paths, and Hub CLI fallback. It reads the project's `ProjectVersion.txt` to find the matching editor version.

If detection fails, ask the user to set `UNITY_EDITOR_PATH` environment variable.

## Step 3: Build and run the command

Construct the Unity CLI command with batchmode defaults:

```bash
"$UNITY_PATH" -batchmode -projectPath "<project-root>" <caller-flags> -logFile - [-quit]
```

**Defaults (always include unless caller overrides):**
- `-batchmode` — no GUI
- `-projectPath` — the detected project root
- `-logFile -` — stream log to stdout (use a file path if caller needs to parse logs separately)
- `-quit` — exit after execution. Omit it with `-runTests`: the test runner exits on its own, and with `-quit` Unity can exit before the tests run

**Caller provides:** the purpose-specific flags (e.g., `-runTests`, `-buildTarget`, `-executeMethod`).

**Timeout:** Set to 600000ms (10 minutes) by default. Builds may need longer — caller can override.

## Step 4: Report results

After execution:
- Report Unity exit code (0 = success, non-zero = failure)
- If `-logFile -` was used, relevant log output is already in stdout
- If a log file was used, read the last 50 lines on failure for diagnostics

## Common flags reference

| Purpose | Flags |
|---------|-------|
| Run tests | `-runTests -testPlatform EditMode -testResults <path>` |
| Android build | `-buildTarget Android -executeMethod <method>` |
| iOS build | `-buildTarget iOS -executeMethod <method>` |
| Execute method | `-executeMethod <ClassName.MethodName>` |
| Import assets | `-importPackage <path>` |
| No graphics | `-nographics` (add for headless servers) |

## Platform notes

- **Windows:** Unity path uses forward slashes in bash. The detection script handles conversion.
- **PATH inheritance:** Unity inherits PATH from its parent process (Unity Hub). After PATH changes, restart Hub + Editor.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.