Getting Null Reference exception when trying to access Dialogue Entry IDs
Posted: Mon Feb 17, 2020 4:52 am
I've been trying to access the current conversation Dialogue entry id, only to be returned with a null reference exception. I have the Dialogue Manager in the scene.
I'm not sure if I need to specify the exact conversation name but when trying to Debug.Log(dialogueID), I get nothing, despite the conversation tree running.
I'm not sure if I need to specify the exact conversation name but when trying to Debug.Log(dialogueID), I get nothing, despite the conversation tree running.
Code: Select all
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using PixelCrushers.DialogueSystem;
using System.Linq;
public class SandwichEvents : MonoBehaviour
{
/// <summary>
/// This script checks if tags of sandwich assets match the conversation entry id
/// </summary>
private int dialogueID;
public void Start()
{
// dialogueEntryID = DialogueManager.LastConversationID;
//actorID = DialogueManager.currentConversationState.subtitle.speakerInfo.id;
dialogueID = DialogueManager.currentConversationState.subtitle.dialogueEntry.id;
}