Skip to content

Instantly share code, notes, and snippets.

@nkjzm
Created August 18, 2018 14:31
Show Gist options
  • Save nkjzm/d5e0992ee606d933330e79b5ae289143 to your computer and use it in GitHub Desktop.
Save nkjzm/d5e0992ee606d933330e79b5ae289143 to your computer and use it in GitHub Desktop.
【Unity】コマンドライン引数で単一ビルドに複数ビルドの振る舞いをさせる ref: https://qiita.com/splas_boomerang/items/0bb9335111a596b6774f
./test.exe -mode 1
public class Test : MonoBehaviour
{
void Start()
{
string[] args = System.Environment.GetCommandLineArgs();
for (int i = 0; i < args.Length; ++i)
{
switch (args[i])
{
case "-mode":
int mode = 0;
if (i + 1 < args.Length && int.TryParse(args[i + 1], out mode))
{
// do something
}
break;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment