public bool AddRes(string path) { var key = AssetUtility.GetAssetNameFromPath(path); if (content.ContainsKey(key)) { throw new ArgumentException("Duplicate Named Resources:" + key); } else { Shader s = AssetUtility.LoadAssetAtFullPath <Shader>(path); if (s) { content.Add(key, s.name); } } return(true); }
public void SearchAll() { var resDirs = new List <DirectoryInfo>(); foreach (var path in SearchPaths) { resDirs.Add(new DirectoryInfo(path)); } foreach (var e in resDirs) { var files = e.GetFiles("*", SearchOption.AllDirectories) .Where(file => !file.Name.EndsWith(".meta")); foreach (var f in files) { for (var i = 0; i < generators.Count; ++i) { if (generators[i].Belong(f.FullName)) { try { generators[i].AddRes(f.FullName); } catch (Exception ex) { Debug.LogError("Auto generate class R failed in: " + f.FullName, AssetUtility.LoadAssetAtFullPath <UnityEngine.Object>(f.FullName)); Debug.LogException(ex); } } } } } }