示例#1
0
        public static void Create()
        {
            var db = Init();

            Instance = CreateInstance <UsageDatabase>();
            if (db)
            {
                Instance.LogUpdate       = db.LogUpdate;
                Instance.LogChangedFiles = db.LogChangedFiles;
                Instance.SaveDelay       = db.SaveDelay;
            }
            db = Instance;
            var paths = AssetDatabase.GetAllAssetPaths();

            for (int i = 0, iCount = paths.Length; i < iCount; i++)
            {
                if (ShowProgress("Creating " + ClassName, i, iCount, true))
                {
                    DestroyImmediate(db);
                    return;
                }
                db.AddRefer(paths[i]);
            }
            AssetDatabase.CreateAsset(db, DataPath);
            Debug.Log($"{ClassName} created. {db.CountInfo}", db);
        }
示例#2
0
 public static UsageDatabase Init(bool create = false)
 {
     if (Instance == null)
     {
         Instance = AssetDatabase.LoadAssetAtPath <UsageDatabase>(DataPath);
         if (Instance == null && create)
         {
             Create();
         }
     }
     return(Instance);
 }