Ejemplo n.º 1
0
    void ProcessFinishedOperation(AssetBundleLoadOperation operation)
    {
        AssetBundleDownloadOperation download = operation as AssetBundleDownloadOperation;

        if (download == null)
        {
            return;
        }

        if (string.IsNullOrEmpty(download.error))
        {
#if UNITY_EDITOR
            for (int i = 0; i < editorShaders.Length; i++)
            {
                if (editorShaders[i].Equals(download.assetBundleName))
                {
                    Material mat = download.assetBundle.m_AssetBundle.LoadAsset <Material>(editorMats[i]);
                    mat.shader      = Shader.Find(mat.shader.name);
                    mat.renderQueue = editorRenderQueues[i];
                }
            }
#endif
            m_LoadedAssetBundles.Add(download.assetBundleName, download.assetBundle);
        }
        else
        {
            string msg = string.Format("Failed downloading bundle {0} from {1}: {2}",
                                       download.assetBundleName, download.GetSourceURL(), download.error);
            m_DownloadingErrors.Add(download.assetBundleName, msg);
        }

        m_DownloadingBundles.Remove(download.assetBundleName);
    }
Ejemplo n.º 2
0
 static public int get_assetBundle(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         AssetBundleDownloadOperation self = (AssetBundleDownloadOperation)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.assetBundle);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Ejemplo n.º 3
0
    private void ProcessFinishedOperation(AssetBundleLoadOperation operation)
    {
        AssetBundleDownloadOperation download = operation as AssetBundleDownloadOperation;

        if (download == null)
        {
            return;
        }
        if (download.error == null)
        {
            m_LoadedAssetBundles.Add(download.assetBundleName, download.assetBundle);
        }
        else
        {
            string msg = string.Format("Failed downloading bundle {0} from {1}", download.assetBundleName, download.error);
            m_DownloadingErrors.Add(download.assetBundleName, msg);
        }
        m_DownloadingBundles.Remove(download.assetBundleName);
    }