In software development, MAC addresses can be used as a unique indication of the device, and we can also get it through unity, which can be tested by Pc,ios but not available to Android.
The code is as follows:
usingUnityengine;usingSystem.Collections;usingSystem.Net.NetworkInformation; Public classnetworkinfo:monobehaviour{voidStart () {Debug.Log (getmacaddress ()); } Public Static stringgetmacaddress () {stringPhysicaladdress =""; Networkinterface[] Nice=networkinterface.getallnetworkinterfaces (); foreach(NetworkInterface AdaperinchNice ) {Debug.Log (adaper). Description); if(Adaper. Description = ="En0") {physicaladdress=Adaper. Getphysicaladdress (). ToString (); Break; } Else{physicaladdress=Adaper. Getphysicaladdress (). ToString (); if(Physicaladdress! ="") { Break; }; } } returnphysicaladdress; }
voidOngui () {GUI. Label (NewRect (0,0, $, -),"mac="+getmacaddress ()); }}
Additional notes:
usingUnityengine;usingSystem.Collections;usingSystem.Net.NetworkInformation; Public classTest:monobehaviour {voidStart () {networkinterface[] NIS=networkinterface.getallnetworkinterfaces (); foreach(NetworkInterface niinchNIS) {Debug.Log ("Name ="+ni. Name); Debug.Log ("Des ="+ni. Description); Debug.Log ("Type ="+ni.NetworkInterfaceType.ToString ()); Debug.Log ("MAC address ="+ni. Getphysicaladdress (). ToString ()); Debug.Log ("------------------------------------------------"); } }}
Unity Foundation Development----Unity gets information such as the MAC address of the Pc,ios system