Page 1 of 2

Conversation portrait animations

Posted: Wed Jul 12, 2023 6:59 am
by Oskar
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:

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);
        }
    }
}
What could be the fix to this issue? Thanks!

Re: Conversation portrait animations

Posted: Wed Jul 12, 2023 10:14 am
by Tony Li
Hi,

You could change that SetPortraitImageWhenOpen method to slide the portrait in from the side. It's already a coroutine, which is a common way to perform tasks over time such as sliding an image in from the side.

Re: Conversation portrait animations

Posted: Tue Jul 18, 2023 7:39 am
by Oskar
Thanks for the answer! We decided to fix the issue via adding a separate panel for the player portrait that slides in when conversation starts.

On that note, we have another problem considering the NPC portrait animation in the conversation. We have a sliding animation for the NPC portrait that slides in on 'Show' trigger and out on 'Hide' trigger. However, when I exit the conversation and start another one, the NPC portrait gets stuck in the 'hidden' state. We suspect that when opening the second conversation, it doesn't send the 'Show' trigger command for some reason. If this was unclear, I can send a video demonstrating the problem via email. Thanks in advance!

Re: Conversation portrait animations

Posted: Tue Jul 18, 2023 9:59 am
by Tony Li
Hi,

Try ticking the Wait For Open and Wait For Close checkboxes.

Re: Conversation portrait animations

Posted: Wed Jul 19, 2023 7:41 am
by Oskar
The Wait For Open ad Wait For Close are ticked in the portrait right, but it doesn't seem to do the trick. When I ticked them from the Right NPC Template, it messed up the conversation and the portrait still doesn't appear when re-entering the conversation. Any ideas what I could try next? Thanks!

Re: Conversation portrait animations

Posted: Wed Jul 19, 2023 7:41 am
by Oskar
The Wait For Open ad Wait For Close are ticked in the portrait right, but it doesn't seem to do the trick. When I ticked them from the Right NPC Template, it messed up the conversation and the portrait still doesn't appear when re-entering the conversation. Any ideas what I could try next? Thanks!

Re: Conversation portrait animations

Posted: Wed Jul 19, 2023 8:54 am
by Tony Li
Hi,

Are you using the current DS version (2.2.38.2 as of this reply)? If not, please back up your project and then update to the current version. This way we'll be looking at the same version of the UI code.

Re: Conversation portrait animations

Posted: Wed Jul 19, 2023 9:09 am
by Oskar
Yes, that's the version we are currently using.

Re: Conversation portrait animations

Posted: Wed Jul 19, 2023 11:52 am
by Tony Li
Try setting up your animator controller like this:

animator.png
animator.png (10.15 KiB) Viewed 728 times

If that doesn't help, please send a reproduction project to tony (at) pixelcrushers.com. I'll be happy to take a direct look.

Re: Conversation portrait animations

Posted: Tue Aug 01, 2023 4:40 am
by Oskar
I tried your solution but it doesn't seem to do the trick. I sent you the project via email.