Keep Portrait Image and Name Text Visible

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Bolt Elite
Posts: 2
Joined: Sun Jul 03, 2022 3:21 pm

Keep Portrait Image and Name Text Visible

Post by Bolt Elite »

Hey everyone, wanted to reach out and see if anyone has any ideas on how I can keep my NPCs name and background at the bottom right visible at all times. Not sure what I'm doing wrong and this seems to be something that's possible with this tool. Appreciate any help anyone can offer.
Attachments
Screenshot 2022-07-03 122805.png
Screenshot 2022-07-03 122805.png (123.2 KiB) Viewed 238 times
Screenshot 2022-07-03 122832.png
Screenshot 2022-07-03 122832.png (123.88 KiB) Viewed 238 times
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Keep Portrait Image and Name Text Visible

Post by Tony Li »

Hi,

The portrait name is part of the subtitle panel. If the subtitle panel's Visibility is set to Only During Content, as in your example, the portrait name will disappear when the subtitle panel disappears.

Here are two options:

1. Set the subtitle panel's Visibility to Always Once Shown or Until Superceded. This will keep the entire subtitle panel visible when the response menu appears.

2. Or separate the portrait name from the subtitle panel. In the example scene below, I removed the NPC subtitle panel's Portrait Name and added a Permanent Portrait Name to the Dialogue Panel. Then I added a short script to the dialogue UI that sets Permanent Portrait Name.

DS_KeepPortraitNameVisibleExample_2022-07-03.unitypackage

Here's the script:

Code: Select all

using UnityEngine;
using PixelCrushers;
using PixelCrushers.DialogueSystem;

// Alternatively, you could make a subclass of StandardDialogueUI.

public class SetPermanentPortraitName : MonoBehaviour
{
    public UITextField permanentPortraitName;

    public void OnConversationLine(Subtitle subtitle)
    {
        if (subtitle.speakerInfo.isNPC)
        {
            permanentPortraitName.text = subtitle.speakerInfo.Name;
        }
    }
}
Bolt Elite
Posts: 2
Joined: Sun Jul 03, 2022 3:21 pm

Re: Keep Portrait Image and Name Text Visible

Post by Bolt Elite »

This did the trick, thanks for the quick turn around Tony!
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Keep Portrait Image and Name Text Visible

Post by Tony Li »

Glad to help!
Post Reply