Hey Tony,
How can I use a custom field to display conversation text to the dialogue panel? I'm using the WRPG template because I need the conversation/response history to remain visible. Right now I've got a custom string field, "Body" and with my character dialogue as its value. I found this topic and am using your example code as a starting point:
https://pixelcrushers.com/phpbb/viewtop ... tle#p43226
However, upon triggering the conversation at runtime, the panel remains blank.
I'd love to get the pattern down for using fields/values to update text objects and sprites throughout the dialogue canvas hierarchy. Replacing the menu/dialogue text fields with custom ones seemed like the best place to start.
Use custom field value for subtitle text
Re: Use custom field value for subtitle text
Hi,
What are you putting into the dialogue entry's Dialogue Text and/or Menu Text fields? Those fields are for dialogue text (and optionally response menu text).
To show additional text that's not dialogue text, you can create a custom field. For example, let's say you've added a custom Text field named "Mood" where you enter the current mood of the speaker of this dialogue entry:
And you've added a Mood text UI element to your dialogue UI:
Then add a script with an OnConversationLine(Subtitle) method to your Dialogue Manager. Something like:
What are you putting into the dialogue entry's Dialogue Text and/or Menu Text fields? Those fields are for dialogue text (and optionally response menu text).
To show additional text that's not dialogue text, you can create a custom field. For example, let's say you've added a custom Text field named "Mood" where you enter the current mood of the speaker of this dialogue entry:
And you've added a Mood text UI element to your dialogue UI:
Then add a script with an OnConversationLine(Subtitle) method to your Dialogue Manager. Something like:
Code: Select all
public TextMeshProUGUI moodText; // Assign in inspector.
void OnConversationLine(Subtitle subtitle)
{
// This method is called before each subtitle is shown.
// Also update the Mood text:
var mood = Field.LookupValue(subtitle.dialogueEntry.fields, "Mood");
moodText.text = mood;
}
Re: Use custom field value for subtitle text
Currently they're empty, I was hoping to use a custom field to do what they do. I was hoping to display dialogue text with a header of text above it. In other words, I aim to display a title above each dialogue that isn't a response.What are you putting into the dialogue entry's Dialogue Text and/or Menu Text fields? Those fields are for dialogue text (and optionally response menu text).
The header font needs be a larger size than the body/dialogue text.
Header
Body
Response Buttons
I guess what I'm trying to do is create a custom formatted subtitle to push to the dialogue panel. Hoping to do this in a script attached to a separate manager game object.
EDIT: thanks for the example using the Mood field. That is exactly what I needed to affect those other text/sprite objects in the panel hierarchy. Is it possible to use OnConversationLine(Subtitle subtitle) in a script not attached to the DialogueManager game object? I'd like to see the script inspector at runtime. Thanks again!
Re: Use custom field value for subtitle text
Hi,
You can still see the inspector of scripts on the Dialogue Manager at runtime. In the Unity editor's play mode, you can find the Dialogue Manager in the DontDestroyOnLoad scene.
The Dialogue System calls OnConversationLine() on these recipients.
I'm still not quite sure what you're doing with the Dialogue Text field. You might want to use Dialogue Text for the body text and a custom "Header" field for the header text.
You can still see the inspector of scripts on the Dialogue Manager at runtime. In the Unity editor's play mode, you can find the Dialogue Manager in the DontDestroyOnLoad scene.
The Dialogue System calls OnConversationLine() on these recipients.
I'm still not quite sure what you're doing with the Dialogue Text field. You might want to use Dialogue Text for the body text and a custom "Header" field for the header text.