示例#1
0
 private void CheckCreateNewDatabase()
 {
     if (createNewDatabase)
     {
         createNewDatabase = false;
         DialogueManager.Instance.initialDatabase = DialogueSystemMenuItems.CreateDialogueDatabaseInstance();
         DialogueSystemMenuItems.CreateAsset(DialogueManager.Instance.initialDatabase, "Dialogue Database");
     }
 }
        private void CreateInitialDatabase()
        {
            var path = EditorUtility.SaveFilePanelInProject("Create Dialogue Database", "Dialogue Database", "asset", "Save dialogue database asset as", "Assets");

            if (string.IsNullOrEmpty(path))
            {
                return;
            }
            var database = DialogueSystemMenuItems.CreateDialogueDatabaseInstance();

            serializedObject.Update();
            serializedObject.FindProperty("initialDatabase").objectReferenceValue = database;
            serializedObject.ApplyModifiedProperties();
            if (AssetDatabase.LoadAssetAtPath <DialogueDatabase>(path))
            {
                AssetDatabase.DeleteAsset(path);
            }
            AssetDatabase.CreateAsset(database, path);
            AssetDatabase.SaveAssets();
            Selection.activeObject = database;
            PixelCrushers.DialogueSystem.DialogueEditor.DialogueEditorWindow.OpenDialogueEditorWindow();
        }