Skip to content

Jason-hub-star/Unity_Cli_Jason

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Unity CLI Toolkit

for AI-Assisted Unity Workflows

Repeatable Unity automation for Codex, Claude, and AI-assisted workflows

License Language Repo Size Last Commit Stars

Quick Start ยท Setup Guide ยท Examples ยท Contributing


โœจ Features

  • ๐Ÿ”„ Proven Setup Flow โ€” A tested Windows/Codex setup flow for unity-cli
  • โšก PowerShell Helpers โ€” Reusable helpers for safe unity-cli invocation and Unity batch methods
  • ๐Ÿงฉ Custom Tool Templates โ€” Starter templates for writing custom [UnityCliTool] commands
  • โœ… Validation Workflow โ€” Repeatable validation for compile, console, scene, prefab, resource, and test checks
  • ๐Ÿ“‹ Copyable Examples โ€” PowerShell examples that work with Unity + unity-cli out of the box
  • ๐ŸŽฏ Multi-Instance Support โ€” Guidance for choosing the correct Unity Editor with --project
  • ๐Ÿ›ก๏ธ Safer Patterns โ€” Validation patterns for domain reloads, compile waits, and wrapper tools

๐Ÿš€ Quick Start

Note

Prerequisite: unity-cli must be installed and available on your PATH. A Unity project must be open in the Editor.

$PSNativeCommandArgumentPassing = "Standard"
unity-cli --project C:/Path/To/YourProject status
unity-cli --project C:/Path/To/YourProject list
unity-cli --project C:/Path/To/YourProject compile_check_tool

โš™๏ธ How It Works

flowchart LR
    A["๐Ÿค– AI Agent<br/>(Codex / Claude)"] -->|invoke| B["๐Ÿ“œ PowerShell Helpers"]
    B -->|unity-cli| C["๐ŸŽฎ Unity Editor"]
    C -->|execute| D["[UnityCliTool]"]
    D -->|return| E["๐Ÿ“ฆ JSON Result"]
    E -->|parse| A
Loading
Can't see the diagram? View the text version.
AI Agent (Codex/Claude) โ†’ PowerShell Helpers โ†’ Unity Editor โ†’ [UnityCliTool] โ†’ JSON Result โ†’ Agent

๐Ÿ“ Repo Map

Unity_Cli_Jason/
โ”œโ”€โ”€ ๐Ÿ“„ README.md              # You are here
โ”œโ”€โ”€ ๐Ÿ“‚ docs/                   # Setup, troubleshooting, workflow docs
โ”‚   โ”œโ”€โ”€ getting-started.md
โ”‚   โ”œโ”€โ”€ codex-setup.md
โ”‚   โ”œโ”€โ”€ custom-tools.md
โ”‚   โ”œโ”€โ”€ validation-workflow.md
โ”‚   โ””โ”€โ”€ troubleshooting.md
โ”œโ”€โ”€ ๐Ÿ“‚ templates/              # Starter files for custom tools & scripts
โ”‚   โ”œโ”€โ”€ cli-tool-template/
โ”‚   โ”œโ”€โ”€ validation-script/
โ”‚   โ””โ”€โ”€ repo-bootstrap/
โ”œโ”€โ”€ ๐Ÿ“‚ scripts/                # Setup and verification helpers
โ”‚   โ”œโ”€โ”€ invoke-unity-cli-safe.ps1
โ”‚   โ”œโ”€โ”€ wait-unity-ready.ps1
โ”‚   โ””โ”€โ”€ invoke-unity-batch-method.ps1
โ””โ”€โ”€ ๐Ÿ“‚ examples/               # Concrete examples & case studies
    โ”œโ”€โ”€ compile-check/
    โ”œโ”€โ”€ scene-validation/
    โ”œโ”€โ”€ robot-kinematics/
    โ””โ”€โ”€ case-study-kine-tutor3d/

๐Ÿ“– Examples

๐Ÿ”ง Custom Tool Invocation
$PSNativeCommandArgumentPassing = "Standard"
unity-cli --project C:/Path/To/YourProject fk_compute_tool --params '{"template":"ExampleBot","joints":"0,45"}'
โœ… Full Validation Flow
$PSNativeCommandArgumentPassing = "Standard"
./scripts/wait-unity-ready.ps1 -ProjectPath C:/Path/To/YourProject
./scripts/invoke-unity-cli-safe.ps1 -ProjectPath C:/Path/To/YourProject compile_check_tool
./scripts/invoke-unity-cli-safe.ps1 -ProjectPath C:/Path/To/YourProject console_check_tool --params '{"type":"error"}'
./scripts/invoke-unity-cli-safe.ps1 -ProjectPath C:/Path/To/YourProject scene_validate_tool --params '{"name":"all"}'
./scripts/invoke-unity-cli-safe.ps1 -ProjectPath C:/Path/To/YourProject resource_validate_tool
๐Ÿ“œ Script Helpers Reference
Script Description
invoke-unity-cli-safe.ps1 Wraps unity-cli calls with stable PowerShell defaults, retry support, and project-aware status handling
wait-unity-ready.ps1 Waits for the correct Unity project to reach ready, but fails fast on no instance and project locked
invoke-unity-batch-method.ps1 Runs any Unity -executeMethod in batchmode, checks for project-lock conflicts, and can retry once after compile-only passes when you provide a success pattern

๐Ÿ‘ฅ Who This Is For

Audience Use Case
Unity Developers Using AI agents (Codex, Claude, etc.) in your daily workflow
Teams Building project-specific unity-cli custom tools
Anyone Looking for a repeatable way to inspect, validate, and automate Unity Editor state

Note

๐Ÿ“ Design Rules

  • Tool logs and response messages should be written in English.
  • Tool names and parameter shapes should be project-agnostic and reusable across Unity projects.
  • Prefer generic inputs such as scene, required_objects, and forbidden_objects over project-specific names.
  • Keep project-specific behavior behind scene paths, method names, or arrays passed through --params.

๐ŸชŸ Codex / Windows Notes
  • Use registered tool names such as compile_check_tool, not guessed kebab-case aliases.
  • In PowerShell, prefer --params '{"key":"value"}' when passing strings, booleans, or comma-separated values.
  • Set $PSNativeCommandArgumentPassing = "Standard" before invoking complex commands.
  • If more than one Unity project is open, prefer unity-cli --project C:/Path/To/YourProject ....
  • After menu execution, recompiles, or build-target switches, wait for status to return ready before chaining the next command.
  • Prefer scripts/invoke-unity-cli-safe.ps1 inside PowerShell automation when you want retries and clearer failure messages.
  • Prefer scripts/invoke-unity-batch-method.ps1 for batch -executeMethod runs instead of hand-writing raw Unity command lines every time.

Important

โš ๏ธ Known Reality

  • EditMode automation is usually the most reliable baseline.
  • PlayMode automation can be environment-sensitive and may require batch or isolated project workflows.
  • Custom wrapper tools such as run_edit_mode_tests_tool are often more reliable than JSON-heavy test commands in PowerShell scripts.

๐Ÿ—บ๏ธ Roadmap

  • More reusable custom tool templates
  • Better PlayMode runner guidance
  • More agent-specific setup notes
  • Cross-platform examples beyond Windows

๐Ÿค Contributing

Issues

Issues and PRs are welcome, especially for:

  • New generic custom tool templates
  • Better unity-cli validation flows
  • Cross-project examples
  • Windows/macOS/Linux environment notes

Built for AI-assisted Unity workflows

โฌ† Back to top

About

Reusable Unity CLI toolkit for Codex, Claude, and AI-assisted Unity workflows

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors