コード例 #1
0
        public static AssetType GetAsset(TKey key, string path)
        {
            BaseScriptableObjectDatabase <TKey, TValue, AssetType> db = GetDatabase(path);

            UnityEngine.Assertions.Assert.IsNotNull(db, "Database with path " + path + "has not been loaded.");

            return(db.InternalGetAsset(key));
        }
コード例 #2
0
        protected static BaseScriptableObjectDatabase <TKey, TValue, AssetType> GetDatabase(string resourcePath)
        {
            if (s_assetDatabase == null)
            {
                s_assetDatabase = (BaseScriptableObjectDatabase <TKey, TValue, AssetType>)Resources.Load(resourcePath);
            }

            return(s_assetDatabase);
        }
コード例 #3
0
        public static void DeleteEntry(TKey key, TValue value, string path)
        {
            BaseScriptableObjectDatabase <TKey, TValue, AssetType> db = GetDatabaseEditorMode(path);

            db.InternalDeleteEntry(key, value);

            UnityEditor.EditorUtility.SetDirty(db);
            UnityEditor.AssetDatabase.SaveAssets();
        }
コード例 #4
0
        public static void ClearDatabase(string path)
        {
            BaseScriptableObjectDatabase <TKey, TValue, AssetType> db = GetDatabaseEditorMode(path);

            db.InternalClearDatabase();

            UnityEditor.EditorUtility.SetDirty(db);
            UnityEditor.AssetDatabase.SaveAssets();
        }
コード例 #5
0
        protected static BaseScriptableObjectDatabase <TKey, TValue, AssetType> GetDatabaseEditorMode(string path)
        {
            BaseScriptableObjectDatabase <TKey, TValue, AssetType> db = (BaseScriptableObjectDatabase <TKey, TValue, AssetType>)UnityEditor.AssetDatabase.LoadAssetAtPath(path, typeof(BaseScriptableObjectDatabase <TKey, TValue, AssetType>));

            return(db);
        }