simplified network setup

This commit is contained in:
tom.hempel
2025-09-21 23:34:22 +02:00
parent e751acab07
commit 4fbc109b89
16 changed files with 169 additions and 6 deletions

View File

@ -11,6 +11,8 @@ public class UDPAvatarReceiver : MonoBehaviour
{
[Header("Network Configuration")]
[SerializeField] private int listenPort = 8080;
[SerializeField] private bool useGlobalNetworkConfig = true;
[SerializeField] private NetworkConfig networkConfigAsset;
[SerializeField] private bool enableReceiver = true;
[SerializeField] private byte targetPlayerID = 2; // Which player to receive data from (0 = any)
[SerializeField] private bool allowPortSharing = true; // For local testing with multiple components
@ -85,6 +87,16 @@ public class UDPAvatarReceiver : MonoBehaviour
if (targetAvatarRoot == null)
targetAvatarRoot = transform;
// Apply global config if enabled
if (useGlobalNetworkConfig)
{
var cfg = networkConfigAsset != null ? networkConfigAsset : NetworkConfig.Instance;
if (cfg != null)
{
listenPort = cfg.port;
}
}
CacheAvatarComponents();
if (enableReceiver)