Standalone/Client/Exe/Player/Build all refer to the executable the end user will use to run my game.
I'm using Unity as my choice of environment. I'm creating a launcher to start the game. This sounds very redundant, as unity has a "launcher" window, for their standalone builds, but this purpose is to ensure the game is up-to-date by checking for the latest version on a server. I've built the client using a simple WPF application. At this point, I'm trying to think about my various options for making sure the executable for the game is started only from the launcher. However, Unity's standalone builds only accept a few range of arguments. Here's what I'm considering:
copy /b
in command line, and outputting as an exe (then deleting after startup). The exe's are no more than 17mb, so it shouldn't take too long.I really want to use this launcher because:
If you have any other suggestions, or maybe could guide me the right way, let me know. Thank you.
Answered here: http://answers.unity3d.com/questions/366195/parameters-at-startup.html
And from here: https://effectiveunity.com/articles/making-most-of-unitys-command-line/
// Helper function for getting the command line arguments
private static string GetArg(string name)
{
var args = System.Environment.GetCommandLineArgs();
for (int i = 0; i < args.Length; i++)
{
if (args[i] == name && args.Length > i + 1)
{
return args[i + 1];
}
}
return null;
}
You can use System.Environment.GetCommandLineArgs() to access the commandline args in a Unity build.
Not the exact answer, but I needed a launcher for my recent project too.
So I designed my own communication system between the launcher app and the game.
As we open the launcher (a C# Windows Forms Application, looks like a Bethesda game launcher) it begins to listen to a specific port (e.g. 23076 TCP). Then as we open the game, it connects to the launcher server and the launcher will send some data to the game, such as: Is the launcher running? Chosen Resolution, Chosen Quality, Chosen Language, Controls settings, etc.
So we can simply set our options in the launcher and send them to the game trough a TCP connection.
Edit:
If you're looking for more info about this approach, take a look at LitenetLIB library.
It supports Unity and Windows Forms, and I use it to make a connection between my launcher and my game. I also check the validity of the license using my launcher before entering the game.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With