コード例 #1
0
        /// <summary>
        /// Builds presentation deck as a standalone application.
        /// </summary>
        /// <param name="deck">Slide Deck to build.</param>
        public static void BuildPresentation(SlideDeck deck)
        {
            string path = EditorUtility.SaveFolderPanel("Choose Location of the Presentation build", "", "");

            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            updateLoaderScene(deck);
            deck.PrepareSlidesForBuild();

            var scenes = SceneUtils.GetBuildScenes(deck, SlideDeck.PlayModeType.PlayMode, SlideDeck.VisibilityType.Visible);

            scenes.Insert(0, new EditorBuildSettingsScene(SceneUtils.LoaderScenePath, true));

            var options = BuildOptions.ShowBuiltPlayer;

            if (EditorUserBuildSettings.development)
            {
                options |= BuildOptions.Development;
            }
            if (EditorUserBuildSettings.connectProfiler)
            {
                options |= BuildOptions.ConnectWithProfiler;
            }
            if (EditorUserBuildSettings.allowDebugging)
            {
                options |= BuildOptions.AllowDebugging;
            }

            try
            {
                string name;
                switch (EditorUserBuildSettings.activeBuildTarget)
                {
                case BuildTarget.StandaloneWindows:
                case BuildTarget.StandaloneWindows64:
                    name = "Presentation.exe";
                    break;

                default:
                    name = "Presentation";
                    break;
                }
                BuildPipeline.BuildPlayer(scenes.ToArray(), Path.Combine(path, name), EditorUserBuildSettings.activeBuildTarget, options);
            }
            catch (Exception e)
            {
                Debug.Log(e.Message);
            }
        }