exSpriteAnimationDB.CreateDB C# (CSharp) Method

CreateDB() static private method

static private CreateDB ( ) : void
return void
    static void CreateDB()
    {
        dbPath = EditorPrefs.GetString( dbKey, dbPath );

        // first create db directory if not exists
        string dbDir = Path.GetDirectoryName(dbPath);
        if ( new DirectoryInfo(dbDir).Exists == false ) {
            Directory.CreateDirectory (dbDir);
        }

        // get sprite animation clip db, if not found, create one
        db = (exSpriteAnimationDB)AssetDatabase.LoadAssetAtPath( dbPath, typeof(exSpriteAnimationDB) );
        if ( db == null ) {
            db = ScriptableObject.CreateInstance<exSpriteAnimationDB>();
            AssetDatabase.CreateAsset( db, dbPath );
            needSync = true;
        }
        else {
            db = (exSpriteAnimationDB)AssetDatabase.LoadAssetAtPath( dbPath, typeof(exSpriteAnimationDB) );
        }

        //
        if ( version != db.curVersion ) {
            db.curVersion = version;
            needSync = true;
            EditorUtility.SetDirty(db);
        }
    }