I have some doubts about how to implement my dialogues for my needs. What I am looking for:
Screen-Space Bubble panel that follows an actor is the default UI.
When the actor whispers/shouts/thinks, change the panel image accordingly.
During cutscenes, the ability to switch to "narrator" panels that appear on the top left and right corners of the screen, without following any actor. This would be used if the actor does not appear on camera during dialogue.
If possible, animate each panel differently (opening and closing differently)
Currently, I am using "Custom" as the subtitle panel number for each actor with Bubble Panel as a child of the actor object. This way I can assign the follow target for the panel correctly.
I was looking at using the Basic Standard Dialogue UI with different panels (and changing them using SetPanel or markup), but I don't know if that's the correct way of doing it since I cannot assign any follow targets that way.
The Dialogue Manager always points to a main dialogue UI which is typically a standard screen space UI such as Basic Standard Dialogue UI. Use this dialogue UI and its default NPC subtitle panel for your narrator.
Your idea to add different screen space bubble panels to this dialogue UI may work. Try this:
1. Add this UIFollow script to the bubble panel. Set its Container field to the main canvas GameObject. Set its UI field to the bubble panel itself. Leave the Follow This field unassigned for now.
2. Make a subclass of StandardUISubtitlePanel, and apply the subclass to the bubble panel instead of the base StandardUISubtitle Panel. (Info: applying in place) Override the SetContent() method to assign Follow This. Something like:
public override void SetContent(Subtitle subtitle)
{
base.SetContent(subtitle); // EDIT: Added this line. Had initially forgotten it.
GetComponent<UIFollow>().followThis = subtitle.speakerInfo.transform.
}
3. Use SetPanel() or [panel=#] markup tags as normal.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class MyCustomSubtitleUIPanel : StandardUISubtitlePanel
{
public override void SetContent(Subtitle subtitle)
{
GetComponent<UIFollow>().followThis = subtitle.speakerInfo.transform;
base.SetContent(subtitle);
}
}