How can I launch the Unity Editor and open a specific project from C# code?

I created a very simple console application:

using System.Diagnostics;

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            // The project I want to open
            var arg = @"-projectPath C:\Users\Administrator\Downloads\New Unity Project";
         
            // Start Unity and open the project
            Process.Start(@"C:\Program Files\Unity\Editor\Unity.exe", arg);
        }
    }
}

But only the Unity Editor is launched; the specified project is not opened.

What do I need to modify to launch the project?

I haven’t tried this but it would be worth putting your project directory in quotes - the command line interface will just separate ‘C:\Users\Administrator\Downloads\New’, ‘Unity’ and ‘Project’ as 3 arguments otherwise.

1 Like