Extracting some part of conversation in unity

Hi,
I am looking for a way of extracting some part of the text that NPC provides in real time. What I want to do is trigger an event when the NPC says something specific and extract that part of the text out of the speech bubble and show it on a bigger screen.
For example, whenever the NPC says “Hello”, I want to write the “Hello” on a bigger screen.
I know that there are some topics on how to do this in Unreal engine, but I am using Unity.

Hello @Arezoo_Sarshartehran,

Welcome to the Convai Developer Forum!

Thank you for clearly describing your use case!

In Unity, you can achieve this by subscribing to the OnAudioTranscriptAvailable event from the ConvaiNPCAudioManager.cs script. This event provides access to the text transcript that the NPC is speaking.

As an example, you can check the HandleAudioTranscriptAvailable method in ConvaiNPC.cs. In the OnEnable() method, it subscribes to the event like this:

AudioManager.OnAudioTranscriptAvailable += HandleAudioTranscriptAvailable;
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.