public static void BuildStandalonePlayer() { var outputPath = EditorUtility.SaveFolderPanel("Choose Location of the Built Game", "", ""); if (outputPath.Length == 0) { return; } string[] levels = GetLevelsFromBuildSettings(); if (levels.Length == 0) { Debug.Log("Nothing to build."); return; } string targetName = GetBuildTargetName(EditorUserBuildSettings.activeBuildTarget); if (targetName == null) { return; } GameUtility.SafeDeleteFile(outputPath + targetName); // Build and copy AssetBundles. BuildAssetBundles(); AssetBundleUtility.CopyPlatformAssetBundlesToStreamingAssets(); // makesure the local server URL is up-to-dat AssetBundleUtility.WriteAssetBundleServerURL(); AssetDatabase.Refresh(); BuildOptions option = EditorUserBuildSettings.development ? BuildOptions.Development : BuildOptions.None; BuildPipeline.BuildPlayer(levels, outputPath + targetName, EditorUserBuildSettings.activeBuildTarget, option); }
static void Run() { KillRunningAssetBundleServer(); AssetBundleUtility.WriteAssetBundleServerURL(); string args = string.Format("\"{0}\" {1}", AssetBundleConfig.LocalSvrAppWorkPath, Process.GetCurrentProcess().Id); ProcessStartInfo startInfo = ExecuteInternalMono.GetProfileStartInfoForMono(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), GetMonoProfileVersion(), AssetBundleConfig.LocalSvrAppPath, args, true); startInfo.WorkingDirectory = AssetBundleConfig.LocalSvrAppWorkPath; startInfo.UseShellExecute = false; Process launchProcess = Process.Start(startInfo); if (launchProcess == null || launchProcess.HasExited == true || launchProcess.Id == 0) { UnityEngine.Debug.LogError("Unable Start AssetBundleServer process!"); } else { instance.mServerPID = launchProcess.Id; UnityEngine.Debug.Log("Local assetbundle server run!"); } }