Passing parameter with -executeMethod

Is is possible to pass one or more parameters to an Unity script when using -executeMethod from a build script?

I'd like to specify the BuildPipeline parameters from an external script.

AFAIK, it is not possible to directly pass parameters with -executeMethod. The only type of parameter you could technically pass would be strings, anyways.

So, what I'm usually doing is provide one method for each set of options that I really need, and call the different methods as needed.

However, you probably could use Environment.GetCommandLineArgs to get all arguments from the command line and then do your own command line arguments parsing to be a bit more flexible. It still requires some custom string checking and parsing and converting to your actual parameters (likely with some switch-case-constructs), but it would certainly get you a bit more flexibility.

That link from is dead. Here is another article, which describes how to do it: Loading... . The relevant section is somewhere in the middle of the article.


var args = System.Environment.GetCommandLineArgs();

jj_unity328’s answer here helped me: