fixed port conflicts

This commit is contained in:
tom.hempel
2025-09-21 23:54:42 +02:00
parent 4fbc109b89
commit e5580ac741
6 changed files with 54 additions and 10 deletions

View File

@ -62,7 +62,7 @@ namespace Convai.Scripts.Runtime.Multiplayer
if (cfg != null)
{
targetIP = cfg.ipAddress;
targetPort = cfg.port;
targetPort = cfg.multiplayerSpeechPort;
}
}
InitializeNetwork();
@ -93,8 +93,13 @@ namespace Convai.Scripts.Runtime.Multiplayer
private void InitializeConvai()
{
// Get target NPC
if (useActiveNPC)
// Prefer local ConvaiNPC on the same GameObject, then fall back to active NPC
var localNPC = GetComponent<ConvaiNPC>();
if (localNPC != null)
{
sourceNPC = localNPC;
}
else if (useActiveNPC)
{
sourceNPC = ConvaiNPCManager.Instance?.GetActiveConvaiNPC();
}