Conversation portrait animations

Announcements, support questions, and discussion for the Dialogue System.
Oskar
Posts: 15
Joined: Wed May 17, 2023 6:18 am

Conversation portrait animations

Post 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!
User avatar
Tony Li
Posts: 21033
Joined: Thu Jul 18, 2013 1:27 pm

Re: Conversation portrait animations

Post 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.
Oskar
Posts: 15
Joined: Wed May 17, 2023 6:18 am

Re: Conversation portrait animations

Post 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!
Attachments
Screenshot 2023-07-18 143443.png
Screenshot 2023-07-18 143443.png (10.77 KiB) Viewed 578 times
User avatar
Tony Li
Posts: 21033
Joined: Thu Jul 18, 2013 1:27 pm

Re: Conversation portrait animations

Post by Tony Li »

Hi,

Try ticking the Wait For Open and Wait For Close checkboxes.
Oskar
Posts: 15
Joined: Wed May 17, 2023 6:18 am

Re: Conversation portrait animations

Post 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!
Oskar
Posts: 15
Joined: Wed May 17, 2023 6:18 am

Re: Conversation portrait animations

Post 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!
User avatar
Tony Li
Posts: 21033
Joined: Thu Jul 18, 2013 1:27 pm

Re: Conversation portrait animations

Post 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.
Oskar
Posts: 15
Joined: Wed May 17, 2023 6:18 am

Re: Conversation portrait animations

Post by Oskar »

Yes, that's the version we are currently using.
User avatar
Tony Li
Posts: 21033
Joined: Thu Jul 18, 2013 1:27 pm

Re: Conversation portrait animations

Post by Tony Li »

Try setting up your animator controller like this:

animator.png
animator.png (10.15 KiB) Viewed 562 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.
Oskar
Posts: 15
Joined: Wed May 17, 2023 6:18 am

Re: Conversation portrait animations

Post by Oskar »

I tried your solution but it doesn't seem to do the trick. I sent you the project via email.
Post Reply