public DebuggerStartInfo CreateDebuggerStartInfo(ExecutionCommand command)
        {
            var cmd = command as UnityExecutionCommand;

            if (null == cmd)
            {
                return(null);
            }
            var msi = new UnityDebuggerStartInfo("Unity");

            // msi.SetUserAssemblies (null);
            msi.Arguments = string.Format("-projectPath \"{0}\"", cmd.ProjectPath);
            return(msi);
        }
Example #2
0
        /// <summary>
        /// Launch Unity
        /// </summary>
        void StartUnity(UnityDebuggerStartInfo dsi)
        {
            if (string.IsNullOrEmpty(unityPath) || !Util.UnityLaunch)
            {
                return;                 // Wait for remote connection
            }
            if (unityprocess != null)
            {
                throw new InvalidOperationException("Unity already started");
            }

            if (Platform.IsMac && Directory.Exists(unityPath))
            {
                dsi.Arguments = string.Format("-W '{0}' --args {1}", unityPath, dsi.Arguments);
                unityPath     = ("open");
            }

            var psi = new ProcessStartInfo(unityPath)
            {
                Arguments        = dsi.Arguments,
                UseShellExecute  = false,
                WorkingDirectory = Path.GetDirectoryName(unityPath)
            };

            // Pass through environment
            foreach (DictionaryEntry env in Environment.GetEnvironmentVariables())
            {
                Console.WriteLine("{0} = \"{1}\"", env.Key, env.Value);
                psi.EnvironmentVariables[(string)env.Key] = (string)env.Value;
            }
            foreach (var env in dsi.EnvironmentVariables)
            {
                Console.WriteLine("{0} = \"{1}\"", env.Key, env.Value);
                psi.EnvironmentVariables[env.Key] = env.Value;
            }

            // Connect back to soft debugger client
            psi.EnvironmentVariables.Add("MONO_ARGUMENTS", string.Format("--debugger-agent=transport=dt_socket,address=127.0.0.1:{0},embedding=1", clientPort));
            psi.EnvironmentVariables.Add("MONO_LOG_LEVEL", "debug");

            unityprocess = Process.Start(psi);

            unityprocess.EnableRaisingEvents = true;
            unityprocess.Exited += delegate
            {
                EndSession();
            };
        }
		/// <summary>
		/// Launch Unity
		/// </summary>
		void StartUnity (UnityDebuggerStartInfo dsi)
		{
			if (string.IsNullOrEmpty (unityPath) || !Util.UnityLaunch)
				return; // Wait for remote connection
				
			if (unityprocess != null)
				throw new InvalidOperationException ("Unity already started");
				
			if (Platform.IsMac && Directory.Exists (unityPath)) {
				dsi.Arguments = string.Format ("-W '{0}' --args {1}", unityPath, dsi.Arguments);
				unityPath = ("open");
			}
			
			var psi = new ProcessStartInfo (unityPath)
			{
				Arguments = dsi.Arguments,
				UseShellExecute = false,
				WorkingDirectory = Path.GetDirectoryName (unityPath)
			};

			// Pass through environment
			foreach (DictionaryEntry env in Environment.GetEnvironmentVariables ()) {
				Console.WriteLine ("{0} = \"{1}\"", env.Key, env.Value);
				psi.EnvironmentVariables[(string)env.Key] = (string)env.Value;
			}
			foreach (var env in dsi.EnvironmentVariables) {
				Console.WriteLine ("{0} = \"{1}\"", env.Key, env.Value);
				psi.EnvironmentVariables[env.Key] = env.Value;
			}
			
			// Connect back to soft debugger client
			psi.EnvironmentVariables.Add ("MONO_ARGUMENTS",string.Format ("--debugger-agent=transport=dt_socket,address=127.0.0.1:{0},embedding=1", clientPort));
			psi.EnvironmentVariables.Add ("MONO_LOG_LEVEL","debug");
			
			unityprocess = Process.Start (psi);
			
			unityprocess.EnableRaisingEvents = true;
			unityprocess.Exited += delegate
			{
				EndSession ();
			};
		}
		
		public DebuggerStartInfo CreateDebuggerStartInfo (ExecutionCommand command)
		{
			var cmd = command as UnityExecutionCommand;
			if (null == cmd){ return null; }
			var msi = new UnityDebuggerStartInfo ("Unity");
			// msi.SetUserAssemblies (null);
			msi.Arguments = string.Format ("-projectPath \"{0}\"", cmd.ProjectPath);
			return msi;
Example #5
0
 public UnityDebuggerStartInfo(UnityProcess process)
     : base(UnityDebuggerStartInfo.CreateStartArgs(process))
 {
 }