From the Dialogue System 2.2.23, you've added a nicely option the Portrait Native Size checkbox to Standard UI Subtitle Panel.
That works very good, but the current source code has a little problem when the sprite is included Atlas.
Code: Select all
protected virtual void SetPortraitImage(Sprite sprite)
{
if (portraitImage == null) return;
Tools.SetGameObjectActive(portraitImage, sprite != null);
portraitImage.sprite = sprite;
if (usePortraitNativeSize && sprite != null)
{
portraitImage.rectTransform.sizeDelta = new Vector2(sprite.texture.width, sprite.texture.height);
}
}
So I proposal this way below: check the sprite is packed and use sprite.rect.width if it packed.
Code: Select all
protected virtual void SetPortraitImage(Sprite sprite)
{
if (portraitImage == null) return;
Tools.SetGameObjectActive(portraitImage, sprite != null);
portraitImage.sprite = sprite;
if (usePortraitNativeSize && sprite != null)
{
portraitImage.rectTransform.sizeDelta = sprite.packed ?
new Vector2(sprite.rect.width, sprite.rect.height) :
new Vector2(sprite.texture.width, sprite.texture.height);
}
}
Thanks,
Ichijo