Hi,
Is it possible to view the dialog log. What I mean is view past subtitles in a menu after the cutscene has ended.
An array of all past-spoken text can be retrieved through script:
AC.KickStarter.runtimeVariables.GetSpeechLog ();
This returns an array of the SpeechLog class. This can be used to populate e.g. a UI Text component with a list of past-spoken dialogue.
Ok how exactly do I use that?
Do I just make a script and put that in Update()?
What If i want to retrieve specific dialog like from one character only?
You need to write a script that does exactly what you want - this is just a means of accessing the data.
See the Scripting Guide's entry for the class that I linked to - it includes a "speakerName" variable that you can use to filter by a character name.
For example, here is a function that will create a string array of all lines spoken by a character with a given name:
public string[] GetLinesByCharacter (string characterName) { System.Collections.Generic.List<string> linesBySomeCharacter = new System.Collections.Generic.List<string>(); foreach (SpeechLog log in AC.KickStarter.runtimeVariables.GetSpeechLog ()) { if (log.speakerName == characterName) { linesBySomeCharacter.Add (log.fullText); } } return linesBySomeCharacter.ToArray (); }
You can then get such an array by calling e.g.:
string[] lines = GetLinesByCharacter ("Bob");
This array can then be used however you want. If you want to just have it update an attached Text component as one long block of text, for example:
string fullText = ""; foreach (string line in lines) { fullText += line; fullText += "\r\n"; } GetComponent <UnityEngine.UI.Text>().text = fullText;
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
An array of all past-spoken text can be retrieved through script:
This returns an array of the SpeechLog class. This can be used to populate e.g. a UI Text component with a list of past-spoken dialogue.
Ok how exactly do I use that?
Do I just make a script and put that in Update()?
What If i want to retrieve specific dialog like from one character only?
You need to write a script that does exactly what you want - this is just a means of accessing the data.
See the Scripting Guide's entry for the class that I linked to - it includes a "speakerName" variable that you can use to filter by a character name.
For example, here is a function that will create a string array of all lines spoken by a character with a given name:
You can then get such an array by calling e.g.:
This array can then be used however you want. If you want to just have it update an attached Text component as one long block of text, for example: