Page 1 of 1

Get Previous Dialogue Entry Via code?

Posted: Mon Aug 03, 2020 7:17 pm
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

Re: Get Previous Dialogue Entry Via code?

Posted: Mon Aug 03, 2020 8:29 pm
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;
    }
}