Showing the NPS image throughout the dialog box

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Stalker_EG
Posts: 31
Joined: Sun Jul 07, 2019 7:57 pm

Showing the NPS image throughout the dialog box

Post by Stalker_EG »

Good afternoon!
I have a question.
I created my dialogue template. There is one text panel for PC and NPS (character name and text.) but I need to constantly show the NPS image in the center of the screen first and until the end of the dialog. If I create a separate panel for the NPS then the image only appears when it has a replica in the dialog.

I hope that I have explained what I want to achieve in a way that is accessible.
User avatar
Tony Li
Posts: 22154
Joined: Thu Jul 18, 2013 1:27 pm

Re: Showing the NPS image throughout the dialog box

Post by Tony Li »

Hi,

Can you do the following?
  • Assign the center NPS image to the NPC Subtitle Panel's Portrait Image. Deactivate the other portrait image that is inside the subtitle panel.
  • Set the NPC Subtitle Panel's Visibility to Always From Start.
Note: This will show the NPC Subtitle Panel when the conversation starts. it will not hide until the conversation ends.

If you need to hide the NPC Subtitle Panel when the PC is playing a subtitle, then you cannot use the steps above. Instead:
  • Leave the NPC Subtitle Panel's Portrait Image unassigned.
  • Add this script to your dialogue UI or Dialogue Manager, and assign the center NPC image to it:
SetNPSImage.cs

Code: Select all

using UnityEngine;
using UnityEngine.UI;
using PixelCrushers.DialogueSystem;
public class SetNPSImage : MonoBehaviour
{
    public Image NPSImage;
    
    void OnConversationLine(Subtitle subtitle)
    {
        if (subtitle.speakerInfo.isNPC) NPSImage.sprite = subtitle.speakerInfo.portrait;
    }
}
User avatar
Stalker_EG
Posts: 31
Joined: Sun Jul 07, 2019 7:57 pm

Re: Showing the NPS image throughout the dialog box

Post by Stalker_EG »

Thank you very much for the quick response. I'm gonna try to make these decisions today. I'll be sure to report the result.
Post Reply