HUB group not showing player name or portrait

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
cptscrimshaw
Posts: 113
Joined: Sun Sep 20, 2020 8:21 pm

HUB group not showing player name or portrait

Post by cptscrimshaw »

Hi Tony,

I ran into a little bit of an odd issue with an NPC HUB group, where at the outset of the conversation, it isn't showing the player's portrait or name, even though the correct response panel text is coming up. Attached are some screenshots that hopefully will reveal what I've missed.

https://ibb.co/MVRj7m6
https://ibb.co/4jwJCGh
https://ibb.co/D54s2Vv
https://ibb.co/zG7Jyc4
https://ibb.co/pvPD2JK

Not sure if this is a factor at all, but I'm using a custom StandardUISubtitlePanel (code below), however this appears to be working just fine everywhere except for the use case described above.

Code: Select all

public class CustomSubtitlePanel : StandardUISubtitlePanel
{
    public Image namePlate;
    private Image factionBadge;
    private string namePlateColorString;
    private string factionBadgeString;
    private Color namePlateColor;

    public override void SetContent(Subtitle subtitle)
    {
        base.SetContent(subtitle);

        namePlate = GameObjectUtility.GameObjectHardFind("Name Panel").GetComponent<Image>();
        factionBadge = GameObjectUtility.GameObjectHardFind("Faction Dialogue Badge").GetComponent<Image>();

        DialogueActor myDialogueActor = subtitle.speakerInfo.transform?.GetComponent<DialogueActor>();
        Debug.Log(myDialogueActor);
        namePlateColorString = DialogueLua.GetActorField(myDialogueActor.name, "Name Plate Color").asString;
        factionBadgeString = DialogueLua.GetActorField(myDialogueActor.name, "Faction Badge").asString;

        //Update Name Plate Color
        if (ColorUtility.TryParseHtmlString(namePlateColorString, out namePlateColor))
        {
            namePlate.color = namePlateColor;
        }

        //Update Faction Badge
        factionBadge.sprite = RoomManager.Instance.GetFactionBadge(factionBadgeString);

        //Fix for Inn badge placement
        if(factionBadgeString == "Inn")
        {
            factionBadge.rectTransform.anchoredPosition = new Vector3(0, 30, 0);
        }
        else
        {
            factionBadge.rectTransform.anchoredPosition = new Vector3(0, 0, 0);
        }
    }
}
Thanks!
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: HUB group not showing player name or portrait

Post by Tony Li »

Hi,

Check your conversations' properties. In all of the conversations, is the conversation's Actor dropdown set to the Player actor?
cptscrimshaw
Posts: 113
Joined: Sun Sep 20, 2020 8:21 pm

Re: HUB group not showing player name or portrait

Post by cptscrimshaw »

Thanks for the quick reply. Yes, it's set to the Player actor in all instances.
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: HUB group not showing player name or portrait

Post by Tony Li »

You may also need to write a corresponding custom subclass for StandardUIMenuPanel. The StandardUIMenuPanel shows the PC Image and PC Name when showing a response menu.
Post Reply