Hi, I want to ask how to grab/pass the CURRENT speaker name into UI text component.
Not control by Subtitle Panel -> Standard UI Subtitle UI Element -> visibility (Only during content), because I want make sure Actor and Conversant portrait image and name are always show while talking. Then add the current speaker name to other side UI that show in the image that I shared.
Here is the image.
[Solved] How to grab the current speaker name
[Solved] How to grab the current speaker name
Last edited by Remon8399 on Wed Dec 12, 2018 11:44 pm, edited 1 time in total.
Re: [ASK] How to grab the current speaker name
Hi,
If I understand you correctly, assign Speaker Text to all of the subtitle panels' Portrait Name fields.
If that doesn't do what you want, you can write a small script with an OnConversationLine method. The property Subtitle.speakerInfo.Name contains the speaker's name. Example:
Another option is to write a subclass of StandardUISubtitlePanel and override the SetContent method. Then use this subclass on your subtitle panels instead of StandardUISubtitlePanel.
If I understand you correctly, assign Speaker Text to all of the subtitle panels' Portrait Name fields.
If that doesn't do what you want, you can write a small script with an OnConversationLine method. The property Subtitle.speakerInfo.Name contains the speaker's name. Example:
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class SetSpeakerText : MonoBehaviour {
public UnityEngine.UI.Text speakerText; // Assign in inspector.
void OnConversationLine(Subtitle subtitle) {
speakerText.text = subtitle.speakerInfo.Name;
}
}
Re: [ASK] How to grab the current speaker name
Thank you. That is what I want exactly.
Re: [ASK] How to grab the current speaker name
Happy to help!