Example #1
0
    private static AssetBundleManifest LoadManifest()
    {
        AssetBundle         manifestBundle = null;
        AssetBundleManifest manifest       = null;

        try
        {
            byte[] bytes = File.ReadAllBytes(Path.Combine(BuildOutputPath, CurrentBuildTarget.ToString()));
            manifestBundle = AssetBundle.LoadFromMemory(bytes);
            manifest       = manifestBundle.LoadAsset <AssetBundleManifest>("AssetBundleManifest");
        }
        catch (System.Exception e)
        {
            Debug.LogError(e.ToString());
        }
        finally
        {
            if (null != manifestBundle)
            {
                manifestBundle.Unload(false);
                manifestBundle = null;
            }
        }
        Debug.Assert(null != manifest);

        return(manifest);
    }
Example #2
0
        public void SwitchTargetTo(BuildTarget targetTo)
        {
            if (targetTo == CurrentBuildTarget)
            {
                return;
            }

            Debug.LogFormat("{0} => {1}", CurrentBuildTarget.ToString(), targetTo.ToString());

            var libraryPathFrom = LibraryPath(CurrentBranchName, CurrentBuildTarget);
            var libraryPathTo   = LibraryPath(CurrentBranchName, targetTo);

            SwitchLibrary(libraryPathFrom, libraryPathTo);
            if (!EditorUserBuildSettings.SwitchActiveBuildTarget(targetTo))
            {
                Directory.Delete(libraryPathFrom, true);
                UpdateCachedLibrariesInfo();
            }
        }