Exemple #1
0
 private static void ProcessSpecialResource(string path)
 {
     if (m_specialCache.ContainsKey(path))
     {
         return;
     }
     m_specialCache.Add(path, path);
     if (EditorPath.IsShader(path))
     {
         if (!BundleDataManager.CheckPathInBundle(path))
         {
             BundleData shader = BundleDataManager.GetBundleData(BundleName.BN_SHADER);
             if (shader != null && shader.children.Count > 0)
             {
                 BundleDataManager.AddPathToBundle(path, shader.children[0], 1024);
             }
         }
     }
     else if (EditorPath.IsMaterial(path))
     {
         BundleData shaderBundle = BundleDataManager.GetBundleData(BundleName.BN_SHADER);
         if (shaderBundle == null)
         {
             return;
         }
         UnityEngine.Object[] assetAtPath = AssetDatabase.LoadAllAssetsAtPath(path);
         foreach (var obj in assetAtPath)
         {
             if (obj != null && obj.GetType() == typeof(Material))
             {
                 Material mat = obj as Material;
                 if (mat != null && mat.shader != null && !string.IsNullOrEmpty(mat.shader.name))
                 {
                     if (!shaderBundle.includs.Contains(mat.shader.name))
                     {
                         shaderBundle.includs.Add(mat.shader.name);
                     }
                 }
             }
             if ((!(obj is GameObject)) && (!(obj is Component)))
             {
                 Resources.UnloadAsset(obj);
             }
         }
         ProcessClear();
     }
     else if (EditorPath.IsScript(path))
     {
         BundleData script = BundleDataManager.GetBundleData(BundleName.BN_SCRIPT);
         if (script != null && script.children.Count > 0)
         {
             BundleDataManager.AddPathToBundle(path, script.children[0], 1024);
         }
     }
 }