Hey all,
How can I have my Unity3D client read it’s processes’ start arguments? This is on windows. I want it to read its arguments so that I can pass additional info to the client when starting it with a launcher I built.
Thanks,
Christian
Hey all,
How can I have my Unity3D client read it’s processes’ start arguments? This is on windows. I want it to read its arguments so that I can pass additional info to the client when starting it with a launcher I built.
Thanks,
Christian
It sounds like what you are looking for is
System.Environment.CommandLine
System.Environment.CommandLineArgs
The Environment class is part of the .NET framework, so you have to import it by hand at the start of the script. Also keep in mind these two functions are not available in web-player builds.
For more information on .NET classes and functions and where they can be used, read the MonoCompatibility page in the scripting reference (It’s a big one).
Here is what I used for anyone looking.
Just replace -folderInput with whatever tag you are looking for
string[] args = System.Environment.GetCommandLineArgs ();
string input = "";
for (int i = 0; i < args.Length; i++) {
Debug.Log ("ARG " + i + ": " + args *);*
_ if (args == “-folderInput”) {_
* input = args [i + 1];*
* }*
}
Correct MonoCompatibility link