Unity小技巧——获取当前主机网卡的mac地址

这没什么好说的,直接上代码:

public class Test : Monobehaviour
{
    void Start()
    {
        NetworkInterface[] nis = NetworkInterface.GetAllNetworkInterfaces();
        foreach(NetworkInterface ni in nis)
        {
            Debug.Log("Name = " + ni.Name);
            Debug.Log("Des = " + ni.Description);  
            Debug.Log("Type = " + ni.NetworkInterfaceType.ToString());
            Debug.Log("Mac = " + ni.GetPhysicalAddress().ToString());
            Debug.Log("------------------------------------");
        }
    }
}

你可能感兴趣的:(unity,3d)