Get Previous Dialogue Entry Via code?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
dbclutis
Posts: 24
Joined: Tue Feb 25, 2020 7:01 pm

Get Previous Dialogue Entry Via code?

Post by dbclutis »

Hello,

I'm having difficulty figuring out how to retrieve the previous dialogue entry via C#. I am needing the information for a sequencer event if that helps at all.

Thanks,
-D
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Get Previous Dialogue Entry Via code?

Post by Tony Li »

Hi,

You'll have to track that yourself. You can use an OnConversationLine method. For example, add a script like this to the Dialogue Manager:

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;

public class RecordPreviousEntry : MonoBehaviour
{
    public DialogueEntry previousDialogueEntry;
    public DialogueEntry currentDialogueEntry;
    
    void OnConversationStart(Transform actor)
    {
        previousDialogueEntry = null;
    }
    
    void OnConversationLine(Subtitle subtitle)
    {
        previousDialogueEntry = currentDialogueEntry;
        currentDialogueEntry = subtitle.dialogueEntry;
    }
}
Post Reply