Get Gameobject name in sequence based on Dialogueactor component

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Reznik
Posts: 18
Joined: Sat Apr 24, 2021 9:21 am

Get Gameobject name in sequence based on Dialogueactor component

Post by Reznik »

I wanted to see if there was an easy way to get the name of a gameobject based on the dialogue actor component for use in sequence commands.

I can write custom sequence commands if necessary but was curious if there was functionality I may have missed.

Basically i have an actor John Smith and a scene gameobject with the name John and the dialogue actor component attached with John Smith set as the actor. Is there something I can do to get the gameobject name "John" for use in command subject parameters without hardcoding in "John" to the sequence call? In this example he would not be the active actor or listener for a node, but another actor in the overall conversation.

I recently changed some gameobject names tied to actors and lots of conversation code broke and so I'm looking to prevent this for future changes, if possible.
User avatar
Tony Li
Posts: 20771
Joined: Thu Jul 18, 2013 1:27 pm

Re: Get Gameobject name in sequence based on Dialogueactor component

Post by Tony Li »

Hi,

If your setup is like this:
  • Dialogue database actor Name = "John Smith"
  • GameObject name = "John"
  • Dialogue Actor component's Actor dropdown set to "John Smith"
Then if a sequencer command specifies John Smith, it will first try to use a Dialogue Actor whose dropdown is set to John Smith.

If no Dialogue Actor is set to John Smith, it will search for a GameObject whose name is John Smith, giving preference to active GameObjects first, then searching inactive GameObjects.

So if you're using the dialogue database actor name (i.e., John Smith), it should find the subject even if the subject's GameObject name is just "John". You can rename the GameObject whatever you want.

However, if you renamed the dialogue database actor's Name, you'll need to update the Dialogue Actor component and references to the actor's old Name in your sequencer commands. It might be as simple as using the Dialogue Editor's Database > Global Search & Replace function to replace "John Smith" with the new name in your dialogue database.

If that's not practical, then you may need to do something custom.
Reznik
Posts: 18
Joined: Sat Apr 24, 2021 9:21 am

Re: Get Gameobject name in sequence based on Dialogueactor component

Post by Reznik »

Thanks! Appreciate it!
User avatar
Tony Li
Posts: 20771
Joined: Thu Jul 18, 2013 1:27 pm

Re: Get Gameobject name in sequence based on Dialogueactor component

Post by Tony Li »

Happy to help!
Post Reply