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!
Show PC Subtitles During Line - Disable on certain responses
-
- Posts: 6
- Joined: Mon Aug 14, 2023 6:53 pm
Re: Show PC Subtitles During Line - Disable on certain responses
Hi,
You can add a script like this to the Dialogue Manager:
This will bypass PC subtitles if the response text is "Continue" or "End". It relies on the OnConversationLine script message.
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()";
}
}
}
-
- Posts: 6
- Joined: Mon Aug 14, 2023 6:53 pm
Re: Show PC Subtitles During Line - Disable on certain responses
Super simple and elegant, thank you very much! Exactly what I was looking for.