HUB group not showing player name or portrait
Posted: Wed May 12, 2021 5:03 pm
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.
Thanks!
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);
}
}
}