Page 1 of 1

Show PC Subtitles During Line - Disable on certain responses

Posted: Fri Sep 15, 2023 6:07 pm
by apocrypha1
Hi! I've been trying to get the following behaviour to work for a bit now with no results, so thought I might a well ask here.

Basically, I want the setting Show PC Subtitles During Line to be activated UNLESS the player clicks on a response with a generic line, such as "Continue.", "End." ETC.

If the response button the player clicks on does have a text component with that sort of string, I want to temporarily disable the Show PC Subtitles During Line -setting. Then, if the next response button the player clicks on is something other than this sort of generic response, I want to re-enable that setting, for a smoother look.

I've tried modifying the Response Button Template's OnClick Event with this additional behaviour but I'm having difficulty in achieving this result. If it helps, I'm using TextMeshPro and a variant of the Scrolling Dialogue UI Prefab.

Thanks a lot in advance!

Re: Show PC Subtitles During Line - Disable on certain responses

Posted: Fri Sep 15, 2023 11:49 pm
by Tony Li
Hi,

You can add a script like this to the Dialogue Manager:

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;

public class BypassPCSubtitleOnCertainResponses : MonoBehaviour
{
    void OnConversationLine(Subtitle subtitle)
    {
        if (subtitle.speakerInfo.IsPlayer && (subtitle.formattedText.text == "Continue" || subtitle.formattedText.text == "End"))
        {
            subtitle.sequence = "Continue()";
        }
    }
}
This will bypass PC subtitles if the response text is "Continue" or "End". It relies on the OnConversationLine script message.

Re: Show PC Subtitles During Line - Disable on certain responses

Posted: Sat Sep 16, 2023 5:20 am
by apocrypha1
Super simple and elegant, thank you very much! Exactly what I was looking for.

Re: Show PC Subtitles During Line - Disable on certain responses

Posted: Sat Sep 16, 2023 8:30 am
by Tony Li
Glad to help!