Retrieve Conversation by Name and Iterate over convo nodes
Posted: Wed Jul 13, 2016 2:48 am
Hello, I am attempting to iterate over every node in a conversation and check that we have the correct audio file assigned to it. I'm hoping to run this script in the inspector rather than during the game. It it possible to iterate over a conversation and inspect/change the nodes when not running the game? If it is can you point me in the right direction by suggesting what functions I can use to:
- Find a conversation by name. Eg "Chapter 2"
- Iterate over every node in a conversation and retrieve the node 'Dialogue Text' and 'Sequence' text/object?
Heres my current code:
- Find a conversation by name. Eg "Chapter 2"
- Iterate over every node in a conversation and retrieve the node 'Dialogue Text' and 'Sequence' text/object?
Heres my current code:
Code: Select all
using UnityEngine;
using UnityEditor;
using System.Collections;
using PixelCrushers.DialogueSystem;
[ExecuteInEditMode]
public class ValidateConversationNodes : MonoBehaviour {
public string ConversationTranscript = "abc.txt";
public string ConversationName = "Conversation 2";
public bool ValidateConversation = false;
public void Update()
{
if (ValidateConversation)
PerformConversationValidation();
}
private void PerformConversationValidation()
{
// Find conversation by name
// For each node in conversation:
// - Retrieve the nodes' sequence and dialogue text
// - Confirm the node calls the correct audio file (check sequence)
ValidateConversation = false;
Debug.Log("Successfully validated\n");
}
}