static void CopyAssetBundlesTo(string outputPath) { // Clear streaming assets folder. FileUtil.DeleteFileOrDirectory(Application.streamingAssetsPath); Directory.CreateDirectory(outputPath); string outputFolder = AssetBundlePlatformPathManager.GetPlatformFolderForAssetBundles(EditorUserBuildSettings.activeBuildTarget); // Setup the source folder for assetbundles. var source = AssetBundlePlatformPathManager.GetAssetBundleStorePath(); if (!System.IO.Directory.Exists(source)) { Debug.Log("No assetBundle output folder, try to build the assetBundles first."); } // Setup the destination folder for assetbundles. var destination = outputPath + outputFolder; if (System.IO.Directory.Exists(destination)) { FileUtil.DeleteFileOrDirectory(destination); } FileUtil.CopyFileOrDirectory(source, destination); }
public static void BuildAssetBundles() { string fullpath = AssetBundlePlatformPathManager.GetAssetBundleStorePath(); if (!Directory.Exists(fullpath)) { Directory.CreateDirectory(fullpath); } BuildPipeline.BuildAssetBundles(fullpath, 0, EditorUserBuildSettings.activeBuildTarget); }
private IEnumerator Initialize() { #if UNITY_EDITOR // If we're in Editor simulation mode, we don't need the manifest assetBundle. if (SimulateAssetBundleInEditor) { yield break; } #endif string bundleName = AssetBundlePlatformPathManager.GetPlatformAssetbundlePath(); string assetName = "AssetBundleManifest"; WWW download = null; string url = ""; if (m_ManifestFromHttp == true) { url = AssetBundlePlatformPathManager.GetDownloadingHttpAssetBundleURL() + bundleName; } else { url = AssetBundlePlatformPathManager.GetAssetBundleDownloadingURL_StreamingAsset() + bundleName; } ATrace.Log("AssetBundle Manifest :" + url); download = new WWW(url); while (download.isDone != true) { yield return(0); } if (download.error != null) { ATrace.LogError(string.Format("AssetBundle Manifest load Error:{0}", download.error)); } else { m_AssetBundleManifest = download.assetBundle.LoadAsset <AssetBundleManifest>(assetName); if (m_AssetBundleManifest == null) { ATrace.LogError(string.Format("AssetBundle Manifest load Failed")); } else { } } }
public static void SDKGEN() { AssetBundleMenu.RemoveAllSymbol(); AssetBundleMenu.AddSymbol("PISDK"); string dv = "SDK"; string bundleid = "com.pi.unitysdk"; #if UNITY_5_6 PlayerSettings.applicationIdentifier = bundleid; #else PlayerSettings.bundleIdentifier = bundleid; #endif PlayerSettings.productName = "SDK"; SetSign("", "", bundleid, ""); var outputPath = AssetBundlePlatformPathManager.GetAppOutputPath(); if (!Directory.Exists(outputPath)) { Directory.CreateDirectory(outputPath); } if (outputPath.Length == 0) { return; } BuildOptions option = EditorUserBuildSettings.development ? BuildOptions.Development : BuildOptions.None; PlayerSettings.Android.keystoreName = BuildTools.keystoreName; PlayerSettings.Android.keystorePass = BuildTools.keystorePass; PlayerSettings.Android.keyaliasName = BuildTools.keyaliasName; PlayerSettings.Android.keyaliasPass = BuildTools.keyaliasPass; PlayerSettings.iOS.appleEnableAutomaticSigning = false; option = BuildOptions.None; string outputFile = outputPath + "SDK"; BuildPipeline.BuildPlayer(EditorBuildSettings.scenes, outputFile, EditorUserBuildSettings.activeBuildTarget, BuildOptions.AcceptExternalModificationsToPlayer); }
public static void DEMO() { SetProjectName("Demo"); AssetBundleMenu.RemoveAllSymbol(); AssetBundleMenu.AddSymbol("PISDKDEMO"); List <EditorBuildSettingsScene> scenelist = new List <EditorBuildSettingsScene>(); scenelist.Add(new EditorBuildSettingsScene("Assets/Scenes/AppMain_SDKDEMO.unity", true)); EditorBuildSettings.scenes = scenelist.ToArray(); var outputPath = AssetBundlePlatformPathManager.GetAppOutputPath(); if (!Directory.Exists(outputPath)) { Directory.CreateDirectory(outputPath); } if (outputPath.Length == 0) { return; } BuildOptions option = EditorUserBuildSettings.development ? BuildOptions.Development : BuildOptions.None; PlayerSettings.Android.keystoreName = BuildTools.keystoreName; PlayerSettings.Android.keystorePass = BuildTools.keystorePass; PlayerSettings.Android.keyaliasName = BuildTools.keyaliasName; PlayerSettings.Android.keyaliasPass = BuildTools.keyaliasPass; PlayerSettings.iOS.appleEnableAutomaticSigning = false; option = BuildOptions.None; string outputFile = outputPath + "SDKDemo.apk"; BuildPipeline.BuildPlayer(EditorBuildSettings.scenes, outputFile, EditorUserBuildSettings.activeBuildTarget, BuildOptions.None); }
private bool LoadAssetBundleInternal(string assetBundleName, bool fromHttp) { if (m_DownloadingWWWs.ContainsKey(assetBundleName)) { return(true); } WWW download = null; string url = ""; if (fromHttp == true) { url = AssetBundlePlatformPathManager.GetDownloadingHttpAssetBundleURL() + assetBundleName; } else { url = AssetBundlePlatformPathManager.GetAssetBundleDownloadingURL_StreamingAsset() + assetBundleName; } download = WWW.LoadFromCacheOrDownload(url, m_AssetBundleManifest.GetAssetBundleHash(assetBundleName), 0); m_DownloadingWWWs.Add(assetBundleName, download); return(false); }
public static string GetAssetBundleStorePath() { string outputPath = Path.Combine(AssetBundlePlatformPathManager.kAssetBundlesPath, AssetBundlePlatformPathManager.GetPlatformFolderForAssetBundles(EditorUserBuildSettings.activeBuildTarget)); string fullpath = Application.dataPath + "/../../Share/" + outputPath; return(fullpath); }
public static void BuildPlayer() { //var outputPath = EditorUtility.SaveFolderPanel("Choose Location of the Built Game", "", ""); var outputPath = AssetBundlePlatformPathManager.GetAppOutputPath(); if (!Directory.Exists(outputPath)) { Directory.CreateDirectory(outputPath); } 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; } // Build and copy AssetBundles. //BuildAssetBundles(); //CopyAssetBundlesTo(Application.streamingAssetsPath + AssetBundlePlatformPathManager.kAssetBundlesPath); //RunBat(System.Environment.CurrentDirectory + "/../Make_Design.bat"); BuildOptions option = EditorUserBuildSettings.development ? BuildOptions.Development : BuildOptions.None; //Android签名 //PlayerSettings.Android.keystoreName = Application.dataPath + "/../public.keystore"; //PlayerSettings.Android.keystorePass = "******"; //PlayerSettings.Android.keyaliasPass = "******"; //if (PlayerSettings.productName == "Aoni Cam") //{ // PlayerSettings.Android.keyaliasName = "com.pi.aonican"; //} //if (PlayerSettings.productName == "RZ") //{ // PlayerSettings.Android.keyaliasName = "com.pi.rz"; //} //if (PlayerSettings.productName == "USB360") //{ // PlayerSettings.Android.keyaliasName = "com.pi.usb"; //} //if (PlayerSettings.productName == "UVR360") //{ // PlayerSettings.Android.keyaliasName = "com.pi.urbetter"; //} PlayerSettings.Android.keystoreName = BuildTools.keystoreName; PlayerSettings.Android.keystorePass = BuildTools.keystorePass; PlayerSettings.Android.keyaliasName = BuildTools.keyaliasName; PlayerSettings.Android.keyaliasPass = BuildTools.keyaliasPass; PlayerSettings.iOS.appleEnableAutomaticSigning = false; option = BuildOptions.None; //生成版本号文件 GenerateVersionFile(); string outputFile = outputPath + targetName; BuildPipeline.BuildPlayer(levels, outputFile, EditorUserBuildSettings.activeBuildTarget, option); }