protected void OnClickAddResponse(DialogueEditorWindow window) { SerializedObject conversation = window.SerializedConversation; if (conversation != null) { conversation.Update(); // Get serialized property for this node SerializedProperty serialEntry = SerializedConversationUtility.FindEntry(conversation, entryID); if (serialEntry != null) { SerializedDialogueEntryUtility.AddResponse(serialEntry); } conversation.ApplyModifiedProperties(); } }
public static SerializedProperty AddEntry(SerializedObject serialConversation) { SerializedProperty dialogueEntry = null; Conversation conversation = serialConversation.targetObject as Conversation; if (conversation != null) { SerializedProperty entries = serialConversation.FindProperty("Entries"); SerializedProperty nextID = serialConversation.FindProperty("nextID"); int oldSize = entries.arraySize; entries.InsertArrayElementAtIndex(oldSize); dialogueEntry = entries.GetArrayElementAtIndex(oldSize); SerializedDialogueEntryUtility.Initialize(dialogueEntry, conversation, nextID.intValue); nextID.intValue = nextID.intValue + 1; } return(dialogueEntry); }