NetInfo.cs 728 Bytes
Newer Older
cann-alberto's avatar
cann-alberto committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using Mirror;

public class NetInfo : NetworkBehaviour
{
    [SyncVar] private string _ipAddress;
    [SyncVar] private int _port;
    [SyncVar] private string _ipAddressComServer;
    [SyncVar] private int _portComServer;

    // Getter e Setter
    public string IpAddress => _ipAddress;
    public int Port => _port;
    public string IpAddressComServer => _ipAddressComServer;
    public int PortComServer => _portComServer;

    // Set network information
    [Server] // Only the serve can modify these values 
    public void SetNetworkInfo(string ip, int port, string ipCom, int portCom)
    {
        _ipAddress = ip;
        _port = port;
        _ipAddressComServer = ipCom;
        _portComServer = portCom;
    }
}