Changing display name and animated portraits

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Changing display name and animated portraits

Post by VoodooDetective »

This is a niche issue, but there's one instance in my game where I need to change the actor's display name temporarily. I asked about this previously and I think downloaded a little extra for it. I use a lua command called "ChangeActorName."

Code: Select all

        if (DialogueDebug.LogInfo) Debug.Log("Dialogue System: Changing " + actorName + "'s Display Name to " + newDisplayName);
        DialogueLua.SetActorField(actorName, "Display Name", newDisplayName);
        if (DialogueManager.IsConversationActive)
        {
            var actor = DialogueManager.MasterDatabase.GetActor(actorName);
            if (actor != null)
            {
                var info = DialogueManager.ConversationModel.GetCharacterInfo(actor.id);
                if (info != null) info.Name = newDisplayName;
            }
        }
When I do this, the actor's portrait no longer shows up and an error is thrown saying animator is inactive.
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Changing display name and animated portraits

Post by Tony Li »

Hi,

That would be the "Discover Name" example on the Extras page.

What animator is it complaining about? Are you animating portrait images?
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Re: Changing display name and animated portraits

Post by VoodooDetective »

It's complaining about the portrait animator. Neither animated portrait nor portrait show up if I change the actor name.
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Changing display name and animated portraits

Post by Tony Li »

Here's an example that you can compare. I exported it from Unity 2019.3. It combines the "Discover Name Example" scene with the "Animated Portrait Example" scene. The character whose names changes also changes panels, but I tested it without changing panels and that works, too.

DS_AnimatedPortraitsChangeNameExample_2020-07-07.unitypackage

If that doesn't help, can you please provide reproduction steps, and let me know what version of the Dialogue System you're using?
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Re: Changing display name and animated portraits

Post by VoodooDetective »

Shoot, I apologize! I just tested the example you gave and it worked fine. I just realized the DialogueActor's game object was inactive when the conversation started in my game. I use SetActive() so I didn't notice, but if the game object isn't active when the conversation begins, and I don't set a default portrait (I think that's possible) then I run into the issue.

I just activated the object and it worked fine. Sorry for taking up your time!
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Changing display name and animated portraits

Post by Tony Li »

No worries; just glad it's working.
Post Reply