Ejemplo n.º 1
0
        static async Task <AssetBundle> LoadAssetBundleRaw(string assetBundleName)
        {
            const int kTimeout = 20000;
            var       path     = BundleUtility.GetLocalBundlePath(assetBundleName);
            var       loadTask = AssetBundle.LoadFromFileAsync(path).ToTask();

            if (await Task.WhenAny(loadTask, Task.Delay(kTimeout)) == loadTask)
            {
                return(loadTask.Result.assetBundle);
            }
            else
            {
                Debug.LogError($"Asset Bundle Load timed out. Bundle Name: {assetBundleName}. Timeout: {kTimeout}");
                throw new Exception($"Asset Bundle Load timed out. Bundle Name: {assetBundleName}. Timeout: {kTimeout}");
            }
        }
Ejemplo n.º 2
0
 public static bool IsValidLocalBundle(string path)
 {
     return(File.Exists(BundleUtility.GetLocalBundlePath(path)));
 }