I have massive text to input (5k lines in spreadsheet). So I think it's easier for me to export the spreadsheet, put the text, and then import it.
So, to do that, I need to automatically create numbers of nodes, which is I tried, but the outcome is not what I want it. Here's the code:
Code: Select all
[ExecuteInEditMode]
public class AddchildDialogueManager : MonoBehaviour
{
public bool execute = false;
public DialogueDatabase db;
public int idConversation = 0;
public int numberCreate = 0;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (execute)
{
List <DialogueEntry> entries = db.conversations[idConversation].dialogueEntries;
for(int i=0; i < numberCreate; i++)
{
DialogueEntry prevEntry = entries[entries.Count - 1];
DialogueEntry entry = new DialogueEntry();
entry.id = entries[entries.Count - 1].id + 1;
prevEntry.outgoingLinks.Add(new Link(idConversation, prevEntry.id, idConversation, entry.id));
entries.Add(entry);
}
db.conversations[idConversation].dialogueEntries = entries;
execute = false;
}
}
}
And it gaves me this null refference errors:
NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.DialogueSystem.Field.SetValue (System.Collections.Generic.List`1 fields, System.String title, System.String value, FieldType type) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Model/Data/Field.cs:351)
PixelCrushers.DialogueSystem.Field.SetValue (System.Collections.Generic.List`1 fields, System.String title, System.String value) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Model/Data/Field.cs:369)
PixelCrushers.DialogueSystem.DialogueEntry.set_Title (System.String value) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Model/Data/DialogueEntry.cs:138)
PixelCrushers.DialogueSystem.DialogueEditor.DialogueEditorWindow.DrawDialogueEntryFieldContents () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Editor/Dialogue Editor/DialogueEditorWindowDialogueTreeSection.cs:544)
PixelCrushers.DialogueSystem.DialogueEditor.DialogueEditorWindow.DrawDialogueEntryInspector () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Editor/Dialogue Editor/DialogueEditorWindowDialogueTreeSection.cs:899)
PixelCrushers.DialogueSystem.DialogueDatabaseEditor.DrawInspectorSelection () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Editor/Dialogue Editor/DialogueDatabaseEditor.cs:186)
PixelCrushers.DialogueSystem.DialogueDatabaseEditor.OnInspectorGUI () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Editor/Dialogue Editor/DialogueDatabaseEditor.cs:67)
UnityEditor.InspectorWindow.DoOnInspectorGUI (Boolean rebuildOptimizedGUIBlock, UnityEditor.Editor editor, Boolean wasVisible, UnityEngine.Rect& contentRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1625)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Do you have solution for this? Thank you...