private DialogueDatabase LoadOrCreateDatabase(string filename) { string assetPath = string.Format("{0}/{1}.asset", prefs.outputFolder, filename); DialogueDatabase database = null; if (prefs.overwrite) { database = AssetDatabase.LoadAssetAtPath(assetPath, typeof(DialogueDatabase)) as DialogueDatabase; if (database != null) { database.Clear(); } } if (database == null) { assetPath = AssetDatabase.GenerateUniqueAssetPath(string.Format("{0}/{1}.asset", prefs.outputFolder, filename)); database = DatabaseUtility.CreateDialogueDatabaseInstance(); AssetDatabase.CreateAsset(database, assetPath); } return(database); }
/// <summary> /// Initializes a new DatabaseManager. Loading of the default database is delayed until the /// first time the database is accessed. If you want to manually load the database, you can /// reset it or add a database to it. /// </summary> /// <param name='defaultDatabase'> /// (Optional) The default database. /// </param> public DatabaseManager(DialogueDatabase defaultDatabase = null) { m_masterDatabase = DatabaseUtility.CreateDialogueDatabaseInstance(); this.defaultDatabase = defaultDatabase; }