Page 1 of 1

Retrieve name of GameObject in Dialogue

Posted: Thu Jan 07, 2021 11:22 pm
by hillka28
First off, thank you for building such an amazing system - your documentation is really thorough, and I have been loving how powerful this is as I continue using it and learning.

In my game, there are "road signs" (i.e. starting a conversation with it will have it read "Route 2" or "Kentucky", and so on). Basically, a non-living readable object. Instead of creating an actor for each of these road signs, I was hoping to reuse one conversation and simply have the dialogue text display the name of the actor game object so that I can use the exact same road sign prefab while only changing the gameobject's name. Is this something that is possible? I've tried a number of solutions, and when debugging with the Info setting on, it did print the following:

Code: Select all

Dialogue System: Starting conversation 'Road Sign', actor=Route 2(UnityEngine.Transform), conversant=Player (UnityEngine.Transform).UnityEngine.Debug:Log(Object, Object)
This is what I was hoping to see, but when I call the conversant variable in the Dialogue Text field, it returns an empty string (I assume because the Conversant dropdown is empty, but I thought I read that it then defaults to the gameobject name which was printed in the log above). Below is my super basic configuration:







If you need any additional information, just let me know. Thanks for your time!

Re: Retrieve name of GameObject in Dialogue

Posted: Fri Jan 08, 2021 10:20 am
by Tony Li
Hi,

Add a Dialogue Actor component to the Route 2 GameObject.

Click the round button to the right of the Actor dropdown to turn it into a text entry field. Then enter "Route 2".

Retrieve name of GameObject in Dialogue

Posted: Fri Jan 08, 2021 2:12 pm
by hillka28
That worked perfectly, thank you so much for your help!

Re: Retrieve name of GameObject in Dialogue

Posted: Fri Jan 08, 2021 2:28 pm
by Tony Li
Glad to help!