38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using UnityEngine;
|
|
|
|
[CreateAssetMenu(fileName = "NetworkConfig", menuName = "Config/Network Config")]
|
|
public class NetworkConfig : ScriptableObject
|
|
{
|
|
[Header("Global Network Settings")]
|
|
public string ipAddress = "127.0.0.1";
|
|
public int port = 1221; // Single port for all UDP communication
|
|
|
|
[Header("Peer Discovery Settings")]
|
|
[Tooltip("Enable auto-discovery to find peer Quest Pro on same network")]
|
|
public bool useAutoDiscovery = true;
|
|
|
|
[Tooltip("Fallback broadcast IP if discovery fails (default: 255.255.255.255)")]
|
|
public string fallbackBroadcastIP = "255.255.255.255";
|
|
|
|
[Tooltip("How often to broadcast discovery requests (seconds)")]
|
|
public float discoveryIntervalSeconds = 2.0f;
|
|
|
|
[Tooltip("Time before considering peer lost (seconds)")]
|
|
public float peerTimeoutSeconds = 15.0f;
|
|
|
|
private static NetworkConfig _instance;
|
|
public static NetworkConfig Instance
|
|
{
|
|
get
|
|
{
|
|
if (_instance == null)
|
|
{
|
|
_instance = Resources.Load<NetworkConfig>("NetworkConfig");
|
|
}
|
|
return _instance;
|
|
}
|
|
}
|
|
}
|
|
|
|
|