Hey there,
I haven't been able to find a solution here yet; maybe someone can help me a little:
Is it possible to assign multiple portrait images in the standard UI subtitle panel? To put my question in concrete terms: I would like to use one portrait slot for the body of each actor and the other for different facial expressions.
Thank you!
Assign multiple portrait images to the subtitle panel?
-
- Posts: 2
- Joined: Wed Jan 05, 2022 4:21 am
Re: Assign multiple portrait images to the subtitle panel?
Hi,
Here are two ways you could do this:
1. With a bit of scripting: Make a subclass of StandardUISubtitlePanel. Override SetContent() and SetPortraitImage(). You could, for example:
2. Or set up animated portraits.
Here are two ways you could do this:
1. With a bit of scripting: Make a subclass of StandardUISubtitlePanel. Override SetContent() and SetPortraitImage(). You could, for example:
- In the Dialogue Editor, set the actor's portrait 1 to the base body image.
- Set portraits 2+ to the facial expression images.
- Use [pic=#] markup tags or SetPortrait() sequencer commands to set the portrait to 2+.
- Add a child UI Image to the subtitle panel's Portrait Image.
- In your subclass's SetContent(), set the Portrait Image's sprite to the base body image.
- In SetPortraitImage(), set the child Image to whatever sprite (facial expression) is passed to it.
Example without error checking for brevity
Code: Select all
public class MySubtitlePanel : StandardUISubtitlePanel
{
public override void SetContent(Subtitle subtitle)
{
var actor = DialogueManager.masterDatabase.GetActor(subtitle.speakerInfo.id);
portraitImage.sprite = actor.GetPortraitSprite(); // Set the base body image.
base.SetContent(subtitle);
}
protected override void SetPortraitImage(Sprite sprite)
{ // Set face sprite:
portraitImage.transform.GetChild(0).GetComponent<Image>().sprite = sprite;
}
}
-
- Posts: 2
- Joined: Wed Jan 05, 2022 4:21 am
Re: Assign multiple portrait images to the subtitle panel?
Hello,
first off, thank you for your helpful answer. I followed your first suggestion, which works perfectly with the markup tags. To have the expression stay over a longer period of time, I decided to use the SetPortrait() sequencer command. But now I am facing problems doing so.
As I am using SetPortrait() sequencer, the given portrait (facial expression) replaces the base body image of the following dialog entries.
first off, thank you for your helpful answer. I followed your first suggestion, which works perfectly with the markup tags. To have the expression stay over a longer period of time, I decided to use the SetPortrait() sequencer command. But now I am facing problems doing so.
As I am using SetPortrait() sequencer, the given portrait (facial expression) replaces the base body image of the following dialog entries.
- Attachments
-
- SetPortrait.png (24.45 KiB) Viewed 257 times
Re: Assign multiple portrait images to the subtitle panel?
Hi,
You'll either need to:
1. Write a custom sequencer command that implements code similar to SetPortait() but changes the face image,
2. Or use animated portraits.
This kind of setup usually uses animated portraits, so I suggest investigating that option. Your portrait animations can change the sprite that is assigned to the facial expression image.
You'll either need to:
1. Write a custom sequencer command that implements code similar to SetPortait() but changes the face image,
2. Or use animated portraits.
This kind of setup usually uses animated portraits, so I suggest investigating that option. Your portrait animations can change the sprite that is assigned to the facial expression image.