1. Set up an overhead bubble panel: How To: Show Overhead Conversation Bubble Text. Add the bubble panel as an instance (child) of the actor.
2. Add additional bubble subtitle panels to your actor's GameObject -- for example, with different bubble images for different emotions.
3. Add this script to your actor:
Code: Select all
using PixelCrushers.DialogueSystem;
using UnityEngine;
namespace Gameplay
{
public class SetBubblePanel : MonoBehaviour
{
[SerializeField] private StandardUISubtitlePanel[] _bubblePanels;
void OnConversationLine(Subtitle subtitle)
{
if (subtitle == null) return;
if (subtitle.speakerInfo.transform == this.transform)
{
int index = Field.LookupInt(subtitle.dialogueEntry.fields, "Bubble");
if (0 <= index && index < _bubblePanels.Length)
{
DialogueManager.standardDialogueUI.ForceOverrideSubtitlePanel(_bubblePanels[index]);
}
}
else
{
DialogueManager.standardDialogueUI.ForceOverrideSubtitlePanel(null);
}
}
}
}
5. Add a custom Number field "Bubble" to your dialogue entries. When you want to use a different bubble, set the Bubble field to the element number in the script's Bubble Panels list.
Example scene (including script above):
DS_ChangeBubbleImageExample_2024-11-29.unitypackage