Search Unity

Reliable way for start arguments of unity

Discussion in 'Scripting' started by SynergiAios, Apr 13, 2017.

  1. SynergiAios

    SynergiAios

    Joined:
    Feb 3, 2015
    Posts:
    35
    So I'm currently writing a dedicated server for my game. As I was giving this to testers one feedback was, that it is not really convenient to have a .bat or .sh that contains the parameters -nographics and -batchmode to start as a server properly. So the users always need to use the bat, sh, shortcut I create to start the server.

    This is a really good feedback. As I was looking through all my other games that have dedicated servers with it I saw most of the time that they just had a exe to start. Just a really few of them have to put some arguments to the server.exe to run properly.

    So I want to know if there is any way, to inject those 2 parameters in the exe directly to run for. Some built parameters in unity or something else.

    Of course I could always create another exe that starts the server exe like I could call this server.exe and the real server is something unobvious so the user doesn't click it. But to be quite honest this is mostly the same as the StartServer.bat/.sh

    Is there anything possible?
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    You can provide headless Linux builds which won't require those parameters. For Windows builds though, I'd just create a separate launcher application that launches the server. The launcher doesn't even necessarily need to be made with Unity.
     
    Kiwasi likes this.
  3. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,550
    What Joe said, if you need it for Windows, just use Visual Studio to make a quick console executable that does it for you. Heck, there's even tools online you can use that will convert a .bat file to .exe for you.
    http://www.battoexeconverter.com/
     
    Kiwasi likes this.
  4. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    I would also go with a simple launcher. You can then have a 'start server' and a 'play game' button.