Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Unity command line arguments #2243

Merged
merged 1 commit into from
Jul 16, 2019
Merged

Add Unity command line arguments #2243

merged 1 commit into from
Jul 16, 2019

Conversation

BlueFisher
Copy link
Contributor

Adding addition Unity command line arguments.
I had to build multiple executables for each scene again if I updated ml-agents. It was really tedious. So I would like to write a InitialScene script to load scenes depending on the command line arguments.

public class InitialScene : MonoBehaviour {
    void Start() {
        List<string> commandLineArgs = new List<string>(Environment.GetCommandLineArgs());
        int index = commandLineArgs.IndexOf("--scene");
        if(index == -1) {
            File.WriteAllText("error.log", $"No --scene in {Environment.CommandLine}");
            Application.Quit();
        }
        else {
            string sceneName = commandLineArgs[index + 1];
            SceneManager.LoadScene(sceneName);
        }
    }
}

Then I only have to build once.

@CLAassistant
Copy link

CLAassistant commented Jul 11, 2019

CLA assistant check
All committers have signed the CLA.

@shihzy
Copy link
Contributor

shihzy commented Jul 11, 2019

CC: @harperj

@shihzy shihzy requested a review from harperj July 11, 2019 03:56
@harperj harperj merged commit 76f5e24 into Unity-Technologies:develop Jul 16, 2019
@chriselion chriselion mentioned this pull request Jul 17, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants