How to close editor when using -batchmode

Hi everyone,

I’m using the following batch script to launch the editor in a second unity editor instance:

set PROJECT="C:\Unity\project_1"
"C:\Program Files (x86)\Unity\Editor\Unity.exe" -projectPath %PROJECT% -batchmode

And now, since I can’t see the Unity editor, I would like to know (if it’s possible) how can I close that editor, running that project, using a batch script also?
… to avoid having to go to the Task Manager to kill the process manually.


Take a look at the options in Unity - Manual: Command line arguments

You can use -quit to close the Editor. With -executeMethod you can call a static method that performs whatever you need (e.g. create a standalone player build, run tests, …).

Just look at the examples on that page.

You can add -quit parameter for it to exit automatically. You can also call EditorApplication.Exit
if you want to terminate from code.