/// <summary>
        /// Method called by the UI when the "Build" or "Build and Run" buttons are pressed.
        /// </summary>
        /// <param name="defaultBuildOptions"></param>
        internal static void CallBuildMethods(bool askForBuildLocation, BuildOptions defaultBuildOptions)
        {
            if (EditorCompilationInterface.IsCompiling())
            {
                Debug.LogWarning("Cannot build player while editor is compiling scripts.");
                return;
            }

            // One build at a time!
            if (m_Building)
            {
                return;
            }
            try
            {
                m_Building = true;
                BuildPlayerOptions options = new BuildPlayerOptions();
                options.options = defaultBuildOptions;

                if (getBuildPlayerOptionsHandler != null)
                {
                    options = getBuildPlayerOptionsHandler(options);
                }
                else
                {
                    options = DefaultBuildMethods.GetBuildPlayerOptionsInternal(askForBuildLocation, options);
                }

                if (buildPlayerHandler != null)
                {
                    buildPlayerHandler(options);
                }
                else
                {
                    DefaultBuildMethods.BuildPlayer(options);
                }
            }
            catch (BuildMethodException e)
            {
                if (!string.IsNullOrEmpty(e.Message))
                {
                    Debug.LogError(e);
                }
            }
            finally
            {
                m_Building = false;
            }
        }
示例#2
0
        /// <summary>
        /// Method called by the UI when the "Build" or "Build and Run" buttons are pressed.
        /// </summary>
        /// <param name="defaultBuildOptions"></param>
        static void CallBuildMethods(bool askForBuildLocation, BuildOptions defaultBuildOptions)
        {
            // One build at a time!
            if (m_Building)
            {
                return;
            }
            try
            {
                m_Building = true;
                BuildPlayerOptions options = new BuildPlayerOptions();
                options.options = defaultBuildOptions;

                if (getBuildPlayerOptionsHandler != null)
                {
                    options = getBuildPlayerOptionsHandler(options);
                }
                else
                {
                    options = DefaultBuildMethods.GetBuildPlayerOptionsInternal(askForBuildLocation, options);
                }

                if (buildPlayerHandler != null)
                {
                    buildPlayerHandler(options);
                }
                else
                {
                    DefaultBuildMethods.BuildPlayer(options);
                }
            }
            catch (BuildMethodException e)
            {
                if (!string.IsNullOrEmpty(e.Message))
                {
                    Debug.LogError(e);
                }
            }
            finally
            {
                m_Building = false;
            }
        }