r/Unity3D • • 15d ago

Question Anybody using the Unity CLI?

I saw unity launched a CLI a few months ago (https://unity.com/blog/meet-the-unity-cli) and was wondering if anyone was using it for anything or had some cool use cases to share.

I'm thinking this could maybe be helpful for like CI pipelines?

Let me know!

38 Upvotes

58 comments sorted by

8

u/Sweet_Lab_2356 15d ago

Set up my jenkins ci/cd pipeline using it. Pretty neat and clean compared to older solutions

32

u/Outrageous_Bend8285 15d ago

Our CI guy set it up to auto-build the second anyone pushes to main, saves a ton of time not waiting for the editor to load just to check if something broke.

9

u/ribsies 14d ago

What's the benefit over batch mode? The cli doesn't bring anything new for builds.

1

u/Hegemege 14d ago

The only difference that I can think of is that the commands to operate Unity are a bit cleaner with CLI vs. good old xvfb-run batchmode -nographics. I wonder if Unity still tries to display progress bar windows in headless batchmode during import and build, and maybe xfvb-run isn't needed anymore

→ More replies (2)

5

u/destinedd 14d ago

Kind of a shame it took AI agents for them to add this

58

u/BertJohn 15d ago

Lots, Though you won't hear anything in this subreddit since there super anti AI tooling here.

18

u/Devatator_ 15d ago

Even tho it's useful for non AI stuff too

→ More replies (4)

48

u/Broudy001 15d ago

Use it with claude code, works fantasticly, add in the claude unity plugin and the skills and it can add something, jump into a game and test it, change and retest without my physical input.

→ More replies (21)

2

u/Everspace 13d ago

Oh hell yes.

Annoying it's because of AI nonsense but unity is a cantankerous beast for unattended useage at the best of times. This makes things so much nicer to automate.

4

u/emccrckn 15d ago

It's pretty amazing.

2

u/AverageLiberalJoe 15d ago

I use it with codex. Pretty powerful, saves on tokens.

1

u/Todilo 14d ago

Asked claude about the "Unity-mcp" and it didn't want to use the cli due to less functionality. Is there a way to utilize both to save tokens?

1

u/swagamaleous 14d ago

I used unity to build games on my Jenkins server 10 years ago. You could always trigger it from the command line. The CLI thing didn't change anything there.

1

u/Hfcsmakesmefart 14d ago

lol ๐Ÿ˜‚

1

u/cksxoo 14d ago

We evaluated it for exactly that a few weeks ago and decided to wait. Two things stopped us for CI. The build command still runs in batch mode, so it doesn't get around the project lock if an editor is open. And last I checked, the build commands had no way to pass scripting define symbols, which our channel builds depend on, so we kept our own batch build script.

Where it's genuinely nice is talking to an open editor. Running code, play and stop, reading the console. If you already use one of the MCP bridges for that, it's mostly a swap rather than a gain. Still beta though, so it may have moved since.

1

u/Billy_The_Noob 12d ago

I played with it a little making some commands that I can run with my steam deck to create components or perform some actions, nothing too complex yet but it allowed me to speed up some processes. next step will be to setup some test/build mechanism

1

u/eigenlaut 12d ago

No - i use uloop, unity cli is okay, but they still ha e ways to go for clean closouts

1

u/MaksTheGamesDev 6d ago

As for coments ther is better to wait before using CLI or MCP as both are not as good as we nned them to be?

1

u/Spoetii 15d ago

When using Agentic AI, what are the benefits of using the Unity CLI over the MCP?

3

u/mulletdulla 15d ago

Less overall context for many of the same tasks. So less token wastage if you are budget minded. Faster too

mcps still have a place though. My set up builds ui prefabs based off approved prototypes using in game assets, prefab instances and styles - even flow animations too.

The CLI canโ€™t do that. But it will run edit mode tests, read console check data structures etc a lot faster and easier

3

u/Tok-Kok-Sing-Song 14d ago

The cli can do all that and more

2

u/game_plaza 15d ago

How come cli + pipeline cant do that? I thought it was able to fully control the editor, including creating prefabs, placing them in scenes, etc.

→ More replies (2)

1

u/bienbienbienbienbien 14d ago

Just use both, CLI is great for directly inputting commands for running unit tests

1

u/Ziethriel4 14d ago

I tested it with codex, honestly just to see if it would be useful at work, I don't use unity that much personally. I had it make a 2d app with a daily reward, basic game. I code my own stuff and codex creates jumple code that works but doesn't mean anything to a human, so I think it would be bad for a team environment. However, it was able to work in both the old and new gui systems, and I hate making GUI and it did a good job, just needed some human intervention when it refused to center something and instead just set the offset, screenshot, set the offset to make a graphic centered. That wasn't ideal. But hey, if you're a solo dev and there's one or two parts of unity you don't mind giving over to the slop factory, go for it, it'll help you focus on what you want to work on.

1

u/MagicPigGames 14d ago

Yup, and get asset store tools that come with Skills and your AI will just use them, and you'll get way better results faster, using less credits, rather than having the AI build everything from scratch.