Setting info.Name makes the Dialogue System to not find the actual actor in the scene

Announcements, support questions, and discussion for the Dialogue System.
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

Setting info.Name makes the Dialogue System to not find the actual actor in the scene

Post by fkkcloud »

Hi,

Code: Select all

        if (DialogueManager.IsConversationActive)
        {
            var actorObj = DialogueManager.MasterDatabase.GetActor(actor);
            if (actorObj != null)
            {
                var info = DialogueManager.ConversationModel.GetCharacterInfo(actorObj.id);
                if (info != null) info.Name = foundName;
            }
        }
I am setting actor's name on start conversation like above.
For instance, I am setting Jenny actor's info.Name a pretty girl since its before the girl's name reveal. However, once it is set to a pretty girl, it seems like it can't find Jenny anymore in the scene.

I tried to do like

Code: Select all

info.DisplayName
or something instead of info.Name but I was not able to find it. any suggestions?
User avatar
Tony Li
Posts: 22050
Joined: Thu Jul 18, 2013 1:27 pm

Re: Setting info.Name makes the Dialogue System to not find the actual actor in the scene

Post by Tony Li »

Hi,

When a conversation starts, it caches the conversation actor's info and conversation conversant's info. (Otherwise each node would waste time looking for the correct actors.)

If you want to change that information while a conversation is active, you must set DialogueManager.conversationModel.actorInfo and .conversantInfo.
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

Re: Setting info.Name makes the Dialogue System to not find the actual actor in the scene

Post by fkkcloud »

No, what I meant is that I was able to set it properly with that as you can see my code in the first thread.

What I meant is - as I get to set its info to be "A pretty looking girl" from the actor's name (e.g. Jenny), it seems like its trying to look for "A pretty looking girl" named object in the scene?
I just wanted to change its Display Name during the conversation. (name itself is changed successfully but now its looking for the changed Display Name's gameObject)
User avatar
Tony Li
Posts: 22050
Joined: Thu Jul 18, 2013 1:27 pm

Re: Setting info.Name makes the Dialogue System to not find the actual actor in the scene

Post by Tony Li »

Hi,

You should not change the actor's Name field. I recommend setting the Name field to "Jenny" and the Display Name field to "A pretty looking girl". When the player learns the girl's name, change the Display Name to "Jenny".

The Dialogue System will look for a GameObject whose Dialogue Actor component is set to the Name. If it doesn't find one, it will look for a GameObject whose name is set to the Name.
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

Re: Setting info.Name makes the Dialogue System to not find the actual actor in the scene

Post by fkkcloud »

Hi,



QUESTION A
Setting just Display Name of it also makes it cant find the Dialogue Actor or the gameObject.

Code: Select all

   DialogueLua.SetActorField("Jenny", "Display Name", "A pretty looking girl); 
I set this during the conversation which does not affect the Display Name for the "current conversation" which seems expected.

Then, as I start a new conversation, Display Name got changed but it does not find the actor gameObject any longer. (almost seems like it is looking for a gameObject named "A pretty looking girl"? but I only set Display Name of it..
If this is meant to be like this, then, how do I get the Jenny gameObject while only her Display Name is set to "A pretty looking girl"?




----------------
QUESTION B
If I am not doing below, then how do I set the Display Name to be affected during the "current conversation"?

Code: Select all

        if (DialogueManager.IsConversationActive)
        {
            var actorObj = DialogueManager.MasterDatabase.GetActor(actor);
            if (actorObj != null)
            {
                var info = DialogueManager.ConversationModel.GetCharacterInfo(actorObj.id);
                if (info != null) info.Name = foundName;
            }
        }



----------------
QUESTION C
The Dialogue System will look for a GameObject whose Dialogue Actor component is set to the Name.
"Name" in this quote, are you referring to the info.Name or just Display Name?


----
Btw, in all cases, Dialogue Actor component's actor field is just "Jenny" from the beginning.
User avatar
Tony Li
Posts: 22050
Joined: Thu Jul 18, 2013 1:27 pm

Re: Setting info.Name makes the Dialogue System to not find the actual actor in the scene

Post by Tony Li »

Hi,

Never set info.Name or the actor's Name field.

Only set the Display Name field.

The "Discover Name" example on the Extras page demonstrates how to change a character's display name and make the new name appear immediately in the dialogue UI.

If that doesn't resolve all of the issues, please let me know.
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

Re: Setting info.Name makes the Dialogue System to not find the actual actor in the scene

Post by fkkcloud »

Hi Tony,

For Question A,
I am only setting Display Name, and it does not find the gameObject after I set only Display Name.
e.g. if I set Display Name to be "a pretty looking girl" for Jenny actor, it can't find the Jenny gameObject anymore (the gameObject in the scene with Dialogue Actor Component actor field set to Jenny which worked just fine before I change only Display Name)

For Question B, I did get the code from the example which works. My concern is mostly for Question A.

Once I set the Display Name, it can't find the gameObject anymore.
User avatar
Tony Li
Posts: 22050
Joined: Thu Jul 18, 2013 1:27 pm

Re: Setting info.Name makes the Dialogue System to not find the actual actor in the scene

Post by Tony Li »

Can you please compare this example scene to your setup?

DS_JennyExample_2020-12-03.unitypackage
(Exported from Unity 2019.3.)

The database has an actor whose Name is "Jenny" and Display Name is "A pretty girl".

The scene has a GameObject named "NPC" with a Dialogue Actor set to "Jenny".

When the scene starts, it plays a conversation that moves the camera to the NPC GameObject.
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

Re: Setting info.Name makes the Dialogue System to not find the actual actor in the scene

Post by fkkcloud »

Thanks for the example.

It seems like setting the Display Name via script works for a case but doesn't work for another case. I don't know why.

Both case have only 1 Dialogue Actor component for Jenny.
I am setting the Display Name in Start() so it is set before the conversation starts.

One case works, the other does not.

Case that is not working- object hierarchy
JennyRoot(Clone)
-Jenny_Combat(Clone)
--Jenny_gameplay_v07
--Jenny_DialogueActor <-- and this one has the Dialogue Actor component - actor field - Jenny

Case that is working - object hierarchy
ScnLayout_Ch01(Clone)
-JennyRoot(Clone)
--Jenny_Social(Clone)<-- and this one has the Dialogue Actor component - actor field - Jenny
--Jenny_SMS(Clone)<-- and this one has the Dialogue Actor component - actor field - JennySMS

Anything wrong..?
User avatar
Tony Li
Posts: 22050
Joined: Thu Jul 18, 2013 1:27 pm

Re: Setting info.Name makes the Dialogue System to not find the actual actor in the scene

Post by Tony Li »

Hi,

I don't have enough information to identify the reason. Can you send a reproduction project to tony (at) pixelcrushers.com?
Post Reply