- Home /
Getting android device's IP
I'm currently wonrking in an application for a companny, the app will provide support for those who need help with something related to their business. recently i've been asked to add the device's IP on the object i send with all the information, however, i couldn't find anything about it. Is there a way to get a mobile device's IP via C# script?
Answer by See_Sharp · Mar 16, 2016 at 01:31 PM
Unity has something build-in. instead of few lines of native C# network code, you could just:
Network.player.ipAddress
http://docs.unity3d.com/ScriptReference/NetworkPlayer-ipAddress.html
Works on every platform!
Note that Network.player.ipAddress has been deprecated and no longer works in Unity 2018.2. I am using this solution https://forum.unity.com/threads/get-ip-address.100109/#post-655819 on Windows but it gives an IPv6 hex address on Android. Still looking for a solution for Android to get the IPv4 address