Page 1 of 1

Barks, Portraits, Icons

Posted: Mon May 01, 2023 3:50 pm
by Z4kk
Hello, I recently started using Dialogue System for Unity and I have a question about how and where to store images for Actors. Currently, I have at least three types of images:
  • Portraits used in bark messages.
    Portrait icons used in dialogues.
    Series of large character full body images(similar to visual novels) that will change depending on the dialogue progress.
I have a question regarding barks. Since I use a separate portrait for barks, I tried passing the portrait using the sequence command "SetPortrait(ActorName, pic=2)" to the `START` node of the conversation containing the barks, but without success.

I'm also wondering about the use of Sprite Portraits and Texture Portraits - which portrait index is used?

Perhaps in my case, it's better to use custom fields for all three types of images and modify all the standard scripts (such as Standard Barks UI, etc.)?

Thank you so much for any help!

Re: Barks, Portraits, Icons

Posted: Mon May 01, 2023 4:55 pm
by Tony Li
Hi,
Z4kk wrote: Mon May 01, 2023 3:50 pmI have a question regarding barks. Since I use a separate portrait for barks, I tried passing the portrait using the sequence command "SetPortrait(ActorName, pic=2)" to the `START` node of the conversation containing the barks, but without success.
In the case of barks, SetPortrait() takes effect after the command is run, and doesn't take effect in <START> nodes. So if you use SetPortrait() in one of the bark nodes, it will only appear the second time the character barks. One way to change this behavior is to make a subclass of StandardBarkUI and use the subclass on your character in place of StandardBarkUI. (See this post for tips on replacing with subclasses.)

In general, if you're ever tempted to directly modify any Dialogue System script, make a subclass or use an event hook instead. That way you won't lose your customizations when you update the Dialogue System.

In the case of a StandardBarkUI subclass, you can override Bark() method to set the NPC to portrait 2:

Code: Select all

public class MyBarkUI : StandardBarkUI
{
    public override void Bark(Subtitle subtitle)
    {
        base.Bark(subtitle);
        var actor = DialogueManager.masterDatabase.GetActor(subtitle.speakerInfo.id);
        portraitImage.sprite = actor.GetPortraitSprite(2);
    }
}
Z4kk wrote: Mon May 01, 2023 3:50 pmI'm also wondering about the use of Sprite Portraits and Texture Portraits - which portrait index is used?
Texture Portraits if present; otherwise Sprite Portraits. This is primarily for compatibility with older projects that predated the Sprite type. Nowadays, just assign Sprites to the Sprite Portraits list and leave Texture Portraits blank.