Conversation portrait animations
Posted: Wed Jul 12, 2023 6:59 am
When a conversation starts in our game, we are trying to make it so that the character portraits slide from each side to their default positions. We got the NPC portrait to work by following the 'Dialogue System for Unity 2.x Dialogue UI Tutorial 3 - Animated Portraits'-Youtube tutorial. However, the player portrait doesn't work as intended even though it uses the same kind of animation as the NPC portrait.
The player's subtitle panel overrides the Standard UI Subtitle panels 'OpenStartConversation' method to show the players portrait always; we suspect that this prevents the show animation from triggering.
We use this script to show the player's portrait from the start of the converstaion:
What could be the fix to this issue? Thanks!
The player's subtitle panel overrides the Standard UI Subtitle panels 'OpenStartConversation' method to show the players portrait always; we suspect that this prevents the show animation from triggering.
We use this script to show the player's portrait from the start of the converstaion:
Code: Select all
using System.Collections;
using UnityEngine;
namespace PixelCrushers.DialogueSystem
{
public class StefanoSMSSubtitlePanel : StandardUISubtitlePanel
{
public override void OpenOnStartConversation(Sprite portraitSprite, string portraitName, DialogueActor dialogueActor)
{
DialogueManager.instance.StartCoroutine(SetPortraitImageWhenOpen(portraitSprite));
}
private IEnumerator SetPortraitImageWhenOpen(Sprite portraitSprite)
{
yield return CoroutineUtility.endOfFrame;
SetPortraitImage(portraitSprite);
}
}
}