Unity游戏开发之----mac地址的获取

获取手机的mac地址

通过NetworkInterface.GetAllNetworkInterfaces()可以获取网络硬件信息的一些内容


using UnityEngine;
using System.Collections;
using System.Net.NetworkInformation;

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游戏开发之----mac地址的获取)