Reliable way for start arguments of unity

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?

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.

1 Like

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.

1 Like

I would also go with a simple launcher. You can then have a ‘start server’ and a ‘play game’ button.