Is there a way to run Unity without rendering the scene on the monitor (headless)?

Is there a way to run Unity without rendering the scene on the monitor (headless)?

I am doing some machine learning and I get my environment from Unity in the form of images but the training is taking too long and it keeps me from doing anything else on my system. Is there a way to hide the simulation rendering?
Any help will be highly appreciated.

Solutions/Answers:

Answer 1:

Run Unity in batch mode with -batchmode in combination with -executeMethod <ClassName.MethodName> (and likely -quit, which quits the Editor after commands have finished executing).

For example:

"C:\Program Files\Unity\Editor\Unity.exe" -quit -batchmode -executeMethod MachineLearningTrainer.Start

Note executeMethod only works with static methods.

For more information, see Unity’s documentation on Command line arguments.

References