Created
August 18, 2018 14:31
-
-
Save nkjzm/d5e0992ee606d933330e79b5ae289143 to your computer and use it in GitHub Desktop.
【Unity】コマンドライン引数で単一ビルドに複数ビルドの振る舞いをさせる ref: https://qiita.com/splas_boomerang/items/0bb9335111a596b6774f
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./test.exe -mode 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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