private void BuildApp() { const string fileName = "TSK"; #if UNITY_STANDALONE_WIN const string FolderName = "PC"; const string packName = fileName + ".exe"; #elif UNITY_STANDALONE_OSX const string FolderName = "MAC"; const string packName = fileName + ".app"; #elif UNITY_ANDROID const string FolderName = "AND"; const string packName = fileName + ".apk"; #elif UNITY_IOS const string FolderName = "IOS"; const string packName = fileName + ".ipa"; #endif #if RY_DEBUG const BuildOptions bo = BuildOptions.AllowDebugging | BuildOptions.ConnectWithProfiler; #else const BuildOptions bo = BuildOptions.None; #endif //var verInfo = VersionMgr.LoadAppVersion(); VersionMgr.SaveAppVersion(GitTools.getVerInfo()); AssetDatabase.Refresh(); //清空PC执行文件目录的缓存文件。 string ProductPath = Application.dataPath + "/../../Products"; string ProductPCPath = Path.Combine(ProductPath, FolderName); string BuildName = ProductPCPath + "/" + packName; if (!Directory.Exists(ProductPath)) { Directory.CreateDirectory(ProductPath); } if (!Directory.Exists(ProductPCPath)) { Directory.CreateDirectory(ProductPCPath); } //开始打游戏包 BuildPipeline.BuildPlayer(new string[] { "Assets/Scenes/ZERO.unity", }, BuildName, AssetPacker.buildTarget, bo); #if UNITY_STANDALONE AssetPacker.Log("Coping Essets ..."); SystemTools.CopyDirectory(Application.dataPath + "/../Essets", ProductPCPath + "/Essets"); #endif #if UNITY_IOS XCodePostProcess.OnPostProcessBuild(BuildName); #endif AssetPacker.Log("Build Done: " + BuildName); }
public static void UpdateAssets() { var srcDir = AssetPacker.EditorStreamingAssetsPath; var dstDir = AssetPacker.StreamingAssetsPath; AssetPacker.Log("Copying {0} -> {1}", srcDir, dstDir); AssetPacker.ClearStreamingAssets(); SystemTools.CopyDirectory(srcDir, dstDir, "*.unity3d"); File.Copy(srcDir + "/filelist.bytes", dstDir + "/filelist.bytes", true); AssetPacker.ClearEditorPersistentAssets(); AssetDatabase.Refresh(); AssetPacker.Log("Copying Done"); }