// 打包场景 public static void BuildPlayer() { var outputPath = EditorUtility.SaveFolderPanel("Choose Location of the Built Game", "", ""); if (outputPath.Length == 0) { return; } string[] levels = ExportUtil.GetLevelsFromBuildSettings(); if (levels.Length == 0) { Debug.Log("Nothing to build."); return; } string targetName = ExportUtil.GetBuildTargetName(EditorUserBuildSettings.activeBuildTarget); if (targetName == null) { return; } // Build and copy AssetBundles. BuildScriptTest.BuildAssetLabelsAssetBundles(); BuildScriptTest.CopyAssetBundlesTo(Path.Combine(Application.streamingAssetsPath, ExportUtil.ASSET_BUNDLES_OUTPUT_PATH)); BuildOptions option = EditorUserBuildSettings.development ? BuildOptions.Development : BuildOptions.None; PlayerParam param = new PlayerParam(); param.m_levels = levels; param.m_locationPath = outputPath + targetName; param.m_target = EditorUserBuildSettings.activeBuildTarget; param.m_options = option; ExportUtil.BuildPlayer(param); }