AssetBundle.LoadFromFileAsync自动从云端下载AB,需要使用Unity 2019.4.29f1c109
This commit is contained in:
parent
6f5af33f07
commit
89cc5691cf
2
.gitignore
vendored
2
.gitignore
vendored
@ -94,3 +94,5 @@ Assets/Plugins/SDKBridge*
|
||||
Build/BuildDependenceResource/CurPackEnv.ini
|
||||
Assets/Plugins/VuplexWebViewChromium/log*
|
||||
assetbundleBak*
|
||||
CustomCloudAssets*
|
||||
_win64*
|
||||
|
||||
@ -344,7 +344,9 @@ namespace Pack
|
||||
[InitializeOnLoadMethod]
|
||||
private static void RegisterBuildPlayerHandler()
|
||||
{
|
||||
BuildPlayerWindow.RegisterBuildPlayerHandler(BuildPlayerHandler);
|
||||
// TODO: UNITY
|
||||
// allow Build button in Build Settings window
|
||||
// BuildPlayerWindow.RegisterBuildPlayerHandler(BuildPlayerHandler);
|
||||
EditorApplication.quitting += OnQuitting;
|
||||
}
|
||||
|
||||
|
||||
@ -490,10 +490,12 @@ public class AssetsMgr : SingletonMono<AssetsMgr>
|
||||
string assetbundleName = AssetsObscureUtil.GetABFileName("assetbundle");
|
||||
ulong offset = AssetsObscureUtil.GetABOffset(assetbundleName);
|
||||
path = string.Format("{0}{1}", FileSystem.LocalDocumentPath, assetbundleName);
|
||||
#if !UNITY_INSTANTGAME
|
||||
if (!FileSystem.Exists(path))
|
||||
{
|
||||
path = string.Format("{0}{1}", FileSystem.LocalPackagePath, assetbundleName);
|
||||
}
|
||||
#endif
|
||||
var assetBundleCreateRequest = AssetBundle.LoadFromFileAsync(path, 0, offset);
|
||||
yield return assetBundleCreateRequest;
|
||||
var assetBundleRequest = assetBundleCreateRequest.assetBundle.LoadAssetAsync("AssetBundleManifest");
|
||||
@ -523,10 +525,12 @@ public class AssetsMgr : SingletonMono<AssetsMgr>
|
||||
mResidentAssetBundleList.Add(shaderName);
|
||||
|
||||
string path = string.Format("{0}{1}", FileSystem.LocalDocumentPath, shaderName);
|
||||
#if !UNITY_INSTANTGAME
|
||||
if (!FileSystem.Exists(path))
|
||||
{
|
||||
path = string.Format("{0}{1}", FileSystem.LocalPackagePath, shaderName);
|
||||
}
|
||||
#endif
|
||||
AssetBundleCreateRequest shaderABCreateRequest = AssetBundle.LoadFromFileAsync(path, 0, offset);
|
||||
yield return shaderABCreateRequest;
|
||||
AssetBundle shaderAB = shaderABCreateRequest.assetBundle;
|
||||
@ -708,15 +712,13 @@ public class AssetsMgr : SingletonMono<AssetsMgr>
|
||||
|
||||
string path = string.Format("{0}{1}", FileSystem.LocalDocumentPath, depABName);
|
||||
ulong depOffset = AssetsObscureUtil.GetABOffset(depABName);
|
||||
if (FileSystem.Exists(path))
|
||||
{
|
||||
abRequest = AssetBundle.LoadFromFileAsync(path, 0, depOffset);
|
||||
}
|
||||
else
|
||||
#if !UNITY_INSTANTGAME
|
||||
if (!FileSystem.Exists(path))
|
||||
{
|
||||
path = string.Format("{0}{1}", FileSystem.LocalPackagePath, depABName);
|
||||
abRequest = AssetBundle.LoadFromFileAsync(path, 0, depOffset);
|
||||
}
|
||||
#endif
|
||||
abRequest = AssetBundle.LoadFromFileAsync(path, 0, depOffset);
|
||||
syncReqDict.Add(depABName, abRequest);
|
||||
mCurLoadingBundleDic.Add(depABName, new LoadTask(depABName));
|
||||
}
|
||||
@ -736,15 +738,13 @@ public class AssetsMgr : SingletonMono<AssetsMgr>
|
||||
|
||||
//加载场景ab
|
||||
string sceneABPath = FileSystem.LocalDocumentPath + sceneABName;
|
||||
if (FileSystem.Exists(sceneABPath))
|
||||
{
|
||||
abRequest = AssetBundle.LoadFromFileAsync(sceneABPath, 0, offset);
|
||||
}
|
||||
else
|
||||
#if !UNITY_INSTANTGAME
|
||||
if (!FileSystem.Exists(sceneABPath))
|
||||
{
|
||||
sceneABPath = FileSystem.LocalPackagePath + sceneABName;
|
||||
abRequest = AssetBundle.LoadFromFileAsync(sceneABPath, 0, offset);
|
||||
}
|
||||
#endif
|
||||
abRequest = AssetBundle.LoadFromFileAsync(sceneABPath, 0, offset);
|
||||
yield return abRequest;
|
||||
Bundle bundle = new Bundle(abRequest.assetBundle, levelName);
|
||||
mBundlesLoaded.Add(levelName, bundle);
|
||||
@ -797,15 +797,13 @@ public class AssetsMgr : SingletonMono<AssetsMgr>
|
||||
|
||||
string path = FileSystem.LocalDocumentPath + depABName;
|
||||
ulong depOffset = AssetsObscureUtil.GetABOffset(depABName);
|
||||
if (FileSystem.Exists(path))
|
||||
{
|
||||
abRequest = AssetBundle.LoadFromFileAsync(path, 0, depOffset);
|
||||
}
|
||||
else
|
||||
#if !UNITY_INSTANTGAME
|
||||
if (!FileSystem.Exists(path))
|
||||
{
|
||||
path = FileSystem.LocalPackagePath + depABName;
|
||||
abRequest = AssetBundle.LoadFromFileAsync(path, 0, depOffset);
|
||||
}
|
||||
#endif
|
||||
abRequest = AssetBundle.LoadFromFileAsync(path, 0, depOffset);
|
||||
syncReqDict.Add(depABName, abRequest);
|
||||
mCurLoadingBundleDic.Add(depABName, new LoadTask(depABName));
|
||||
}
|
||||
@ -825,15 +823,13 @@ public class AssetsMgr : SingletonMono<AssetsMgr>
|
||||
|
||||
//加载场景ab
|
||||
string sceneABPath = FileSystem.LocalDocumentPath + sceneABName;
|
||||
if (FileSystem.Exists(sceneABPath))
|
||||
{
|
||||
abRequest = AssetBundle.LoadFromFileAsync(sceneABPath, 0, offset);
|
||||
}
|
||||
else
|
||||
#if !UNITY_INSTANTGAME
|
||||
if (!FileSystem.Exists(sceneABPath))
|
||||
{
|
||||
sceneABPath = FileSystem.LocalPackagePath + sceneABName;
|
||||
abRequest = AssetBundle.LoadFromFileAsync(sceneABPath, 0, offset);
|
||||
}
|
||||
#endif
|
||||
abRequest = AssetBundle.LoadFromFileAsync(sceneABPath, 0, offset);
|
||||
yield return abRequest;
|
||||
Bundle bundle = new Bundle(abRequest.assetBundle, levelName);
|
||||
mBundlesLoaded.Add(levelName, bundle);
|
||||
@ -1628,15 +1624,13 @@ public class AssetsMgr : SingletonMono<AssetsMgr>
|
||||
{
|
||||
string path = string.Format("{0}{1}", FileSystem.LocalDocumentPath, bundleName);
|
||||
ulong offset = AssetsObscureUtil.GetABOffset(bundleName);
|
||||
if (FileSystem.Exists(path))
|
||||
{
|
||||
abRequest = AssetBundle.LoadFromFileAsync(path, 0, offset);
|
||||
}
|
||||
else
|
||||
#if !UNITY_INSTANTGAME
|
||||
if (!FileSystem.Exists(path))
|
||||
{
|
||||
path = string.Format("{0}{1}", FileSystem.LocalPackagePath, bundleName);
|
||||
abRequest = AssetBundle.LoadFromFileAsync(path, 0, offset);
|
||||
}
|
||||
#endif
|
||||
abRequest = AssetBundle.LoadFromFileAsync(path, 0, offset);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user