/// <summary>
        ///     Build method that is invoked by commandline
        /// </summary>
        public static void Build()
        {
            try
            {
                var commandLine = Environment.GetCommandLineArgs();

                Debug.LogFormat("Want to build with args: {0}", String.Join(", ", commandLine));

                var buildTargetArg =
                    CommandLineUtil.GetCommandLineValue(commandLine, "buildTarget", "local");

                if (string.IsNullOrEmpty(buildTargetArg))
                {
                    // The default above does not get filled when -t parameter is not passed
                    buildTargetArg = BuildEnvironment.Local.ToString();
                    Debug.LogWarningFormat("Using default build target value: \"{0}\".", buildTargetArg);
                }

                BuildEnvironment buildEnvironment;

                switch (buildTargetArg.ToLower())
                {
                case "cloud":
                    buildEnvironment = BuildEnvironment.Cloud;
                    break;

                case "local":
                    buildEnvironment = BuildEnvironment.Local;
                    break;

                default:
                    throw new BuildFailedException("Unknown build target value: " + buildTargetArg);
                }

                var workerTypesArg =
                    CommandLineUtil.GetCommandLineValue(commandLine, ConfigNames.BuildWorkerTypes,
                                                        "UnityClient,UnityWorker");

                var wantedWorkerPlatforms = GetWorkerPlatforms(workerTypesArg);

                SpatialCommands.GenerateBuildConfiguration();

                foreach (var workerPlatform in wantedWorkerPlatforms)
                {
                    BuildWorkerForEnvironment(workerPlatform, buildEnvironment);
                }
            }
            catch (Exception e)
            {
                // Log the exception so it appears in the command line, and rethrow as a BuildFailedException so the build fails.
                Debug.LogException(e);

                if (e is BuildFailedException)
                {
                    throw;
                }

                throw new BuildFailedException(e);
            }
        }
        private static void MenuBuild(IEnumerable <WorkerPlatform> platforms, BuildEnvironment environment)
        {
            // Delaying build by a frame to ensure the editor has re-rendered the UI to avoid odd glitches.
            EditorApplication.delayCall += () =>
            {
                Debug.Log("Generating build configuration");
                SpatialCommands.GenerateBuildConfiguration();
                foreach (var platform in platforms)
                {
                    WorkerBuilder.BuildWorkerForEnvironment(platform, environment);
                }

                Debug.LogFormat("Completed build for {0} target", environment);
            };
        }