Parameters at Startup

Hey guys,

I’m having a great deal of trouble figuring out how to get parameters on an application’s StartUp. I’ve been working on this almost all day, but nothing seems to work. I can’t give Start() parameters, and I can’t get Environment.GetCommandLineArgs to return any value. Maybe I’m sending the parameters wrong, but I’m getting tired of trying to figure this out. If any of you can give me a quick example, I’ll be really grateful!

Thanks for your time - Gibson

Under OSX I made the following testrun, maybe it helps you to find your issue

Terminal line:

open CMDTest.app/ --args -myarg andstuff and more

MonoBehavior

using UnityEngine;
using System.Collections;
using System;

public class Info : MonoBehaviour 
{	
	static string cmdInfo = "";

	void Start () 
	{
		string[] arguments = Environment.GetCommandLineArgs();
		foreach(string arg in arguments)
		{
			cmdInfo += arg.ToString() + "

";
}
}

	void OnGUI()
	{
		Rect r = new Rect(5,5, 800, 500);
		GUI.Label(r, cmdInfo);
	}
}