5
\$\begingroup\$

I need to run my game without graphics and user input (headless mode).

I googled it but I actually couldn't find a solution, except something like this:

using UnityEngine;
using System.Collections;
using UnityEditor;

public class a : MonoBehaviour {

    public static void BeforeBuild()
    {
        EditorUserBuildSettings.enableHeadlessMode = true;
    }
}

Unfortunately, this doesn't work for me as it seems to work only on Linux.

Am I forced to run my instance on Linux?

I would be really thankful if anyone could help me!

\$\endgroup\$
  • \$\begingroup\$ "I need to run my game in headless mode" is it really what you need? Or you need something that is provided by the headless mode. \$\endgroup\$ – Vaillancourt Aug 17 '16 at 14:36
  • \$\begingroup\$ This may be useful to you. (Thank Google.) \$\endgroup\$ – Vaillancourt Aug 17 '16 at 14:39
  • 1
    \$\begingroup\$ I'm pretty sure that if you'd followed the tutorial I linked you in your other question you wouldn't have asked this one \$\endgroup\$ – Leggy7 Aug 17 '16 at 14:44
  • 1
    \$\begingroup\$ From your other question: but now I'm going to learn new unity's network service (unet). so befor start, I have question: can I host my own server in unet? Is this a something a taught UNET developer would say? If you follow closely that tutorial you will find out how a master is chosen among peer to act like a server. \$\endgroup\$ – Leggy7 Aug 17 '16 at 15:41
  • 1
    \$\begingroup\$ Honestly, @david's question is pretty reasonable, and the question does make sense. I'm not really sure why people get so nasty about questions like this. Actually, a quick Googling didn't really pull up immediate results for the question. I may have asked this here myself had I needed the feature. \$\endgroup\$ – Jesse Williams Aug 17 '16 at 16:40
10
\$\begingroup\$

From the documentation:

Unity Standalone Player command line arguments

Standalone players built with Unity also understand some command line arguments:

[...]

-batchmode Run the game in “headless” mode. The game will not display anything or accept user input. This is mostly useful for running servers for networked games.

\$\endgroup\$
  • 2
    \$\begingroup\$ -batchmode can also be useful for automated testing. \$\endgroup\$ – Philipp Aug 17 '16 at 14:40
  • \$\begingroup\$ @Alexandre Vaillancourt for some reasons I could not find this document befor I ask this questation!! thanks... \$\endgroup\$ – david Aug 17 '16 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.