Page 1 of 1

Changing display name and animated portraits

Posted: Mon Jul 06, 2020 9:50 pm
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.

Re: Changing display name and animated portraits

Posted: Mon Jul 06, 2020 10:05 pm
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?

Re: Changing display name and animated portraits

Posted: Mon Jul 06, 2020 10:34 pm
by VoodooDetective
It's complaining about the portrait animator. Neither animated portrait nor portrait show up if I change the actor name.

Re: Changing display name and animated portraits

Posted: Tue Jul 07, 2020 12:05 pm
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?

Re: Changing display name and animated portraits

Posted: Tue Jul 07, 2020 2:57 pm
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!

Re: Changing display name and animated portraits

Posted: Tue Jul 07, 2020 3:09 pm
by Tony Li
No worries; just glad it's working.