Ok, I’ve started a new project and upgraded to the latest version of Convai from the Asset Store. I currently have no significant errors and have entered my API Key successfully.
I want nothing at the moment but the ability toggle the character active (NPCActivator is gone?) and be able to converse. I need to turn characters on and off with Unity events.
So, what scripts are required and what’s the best way to hide the UI if that is needed to be in the project.
Thanks for your help!
Hello @Bob_Hawkey,
Could you please show the equivalent setup from your old project? That way, we can better understand what exactly you’re referring to with “NPCActivator.”
If your question is about disabling or hiding the UI, you can do that from the Settings Panel. But if you’re asking how to manage this through code, please clarify so we can provide the right guidance.
Gee, sorry. That NPCAcivator script might have been custom code. I will check. Also - you mean the settings panel in the UI? I don’t want the UI at all. I know there are fields that may be required but the UI is completely unneeded.
Further apologies. The ConvaiNPCActivator was a custom script to avoid the proximity triggering stuff so I could activate a character on demand rather than just standing near them.
I dragged the UI from the old project so I will do some testing now. Thanks for your response as always.
I can share some resources with you tomorrow.
If you’re aiming to fully disable the built-in UI and handle NPC activation manually, here’s what you can do:
-
In
ConvaiNPCManager.cs
, you can comment out the code inside theLateUpdate()
method. Then, manually control the active NPC by calling theSetActiveConvaiNPC()
method when needed. -
For controlling the UI, you can use the
ActivateUI()
andDeactivateUI()
methods fromChatUIBase.cs
. To prevent it from activating automatically, locate whereActivateUI()
is being called (your IDE will help with this) and comment out those lines.
This approach should give you full control over NPC activation and hide the chat UI from your scene. Let us know if you need further help with implementation!
Thank you my friend. That would be a simple solution! I will try it today. I appreciate all your help.
Hi! Didn’t want to bug you on a weekend so I waited on this. The fix you gave me seems to work - at least for outgoing interactions. I can do a ‘SendTextDataAsync’ with just a text string and it shows up in the characters memory and they react to it. However, nothing happens on the receiving end in the app. I suspect it has something to do with this error:
System.Boolean isActionActive, System.Boolean isLipSyncActive, Service.ActionConfig actionConfig, Service.FaceModel faceModel, System.String speakerId) [0x0002e] in E:\Project Files\Virtual Companion 2\Assets\Convai\Scripts\Runtime\Core\ConvaiGRPCAPI.cs:201
at Convai.Scripts.Runtime.Core.ConvaiNPC.SendTextDataAsync (System.String text) [0x00054] in E:\Project Files\Virtual Companion 2\Assets\Convai\Scripts\Runtime\Core\ConvaiNPC.cs:329
[Stack Trace - Method: MoveNext, at Line: 334 in File: E:\Project Files\Virtual Companion 2\Assets\Convai\Scripts\Runtime\Core\ConvaiNPC.cs]
UnityEngine.Debug:LogError (object)
Hello @Bob_Hawkey,
Thanks for your message and no worries, feel free to ask questions anytime!
To better assist you, could you clarify exactly what the issue is? From what I understand, the outgoing interaction using SendTextDataAsync works as expected and the character reacts appropriately. However, there’s no response or visible reaction within the app itself.
Could you confirm:
Which platform your app is running on? Whether this issue only occurs in the build or also in the editor? And if possible, please share the specific error message you mentioned.
Happy to help further once I have those details!