Ejemplo n.º 1
0
        private static AssetRecordScriptableObject CreateScriptableObject()
        {
            string[] keys = CollectionSortHelper.GetSortedArray(_dependentPhysicalPathListDict.Keys);
            AssetRecordScriptableObject obj = ScriptableObject.CreateInstance <AssetRecordScriptableObject>();

            obj.dependencyEntries = new AssetDependencyEntry[keys.Length];
            for (int i = 0; i < keys.Length; i++)
            {
                AssetDependencyEntry entry = new AssetDependencyEntry();
                entry.path = keys[i];
                List <string> dependentPhysicalPathList = _dependentPhysicalPathListDict[keys[i]];
                entry.physicalPaths = new string[dependentPhysicalPathList.Count];
                for (int j = 0; j < dependentPhysicalPathList.Count; j++)
                {
                    entry.physicalPaths[j] = dependentPhysicalPathList[j];
                }
                obj.dependencyEntries[i] = entry;
            }
            return(obj);
        }
Ejemplo n.º 2
0
        public static void ReadAssetRecord()
        {
            _dependentPhysicalPathListDict = new Dictionary <string, List <string> >();
            AssetRecordScriptableObject obj = AssetDatabase.LoadAssetAtPath(ASSET_RECORD_PATH, typeof(AssetRecordScriptableObject)) as AssetRecordScriptableObject;

            if (obj == null)
            {
                return;
            }

            try
            {
                for (int i = 0; i < obj.dependencyEntries.Length; i++)
                {
                    AssetDependencyEntry entry = obj.dependencyEntries[i];
                    _dependentPhysicalPathListDict.Add(entry.path, entry.physicalPaths.ToList());
                }
            } catch (Exception e)
            {
                Debug.LogError("_resources.asset 文件格式错误!");
                Debug.LogError(e.Message);
            }
        }