Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by grimmy · Nov 27, 2013 at 09:30 AM · locationlocalizationip

How do I find out where my player is location (in real life) on PC?

I want to find my player's location (or at least their country) I guess from their ip address, but how do I go about doing this. My mission is to automate language selection to some degree.

Thanks

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

5 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Dover8 · Nov 27, 2013 at 09:44 AM

If your program is on a mobile device you could use the GPS to find out this information.

If it's on PC, then you could retrieve the systems date and time, and then compare it with a service such as the NIST Internet Time Service to find out what time zone they are in.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Komak57 · Nov 27, 2013 at 10:48 AM

Although for other devices, there are API's designed for this intention, you can use a web service to download the raw source to the HTML page returned when querying an IP. One such example is whatismyipaddress.com. GPS coordinates cost a number of phones a service charge to keep online, and re-downloading the weblink again and again can be taxing over time. Grab it once, store it in hash, and just match the current ip with the saved one for changes before re-grabbing information. Since you're looking for language automation, you won't even need to bother. Just grab it once on first-boot, and leave it up to the user to correct it.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by sparky14 · Nov 27, 2013 at 10:48 AM

I found this in some of the answers. This was a resolved question. And they asked the same thing you did basically. Hope it helps.

http://answers.unity3d.com/questions/518346/get-ipv4-adress.html

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by tanoshimi · Nov 27, 2013 at 10:13 AM

As you've identified, step 1 is to get the user's IP, which you can get as follows:

 var hostName = System.Net.Dns.GetHostName();
 var hostEntry = System.Net.Dns.GetHostEntry(hostName);
 var addressList = hostEntry.AddressList;
 var ipAddress = addressList[addressList.Length-1].ToString()

Then you need to lookup that IP address in a geocoded database. There are various webservices that offer this facility, such as http://freegeoip.net/

This is a far from perfect way of determining the user's location, but assuming you offer them the facility to override the automatically chosen language, it should serve as a start.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by ArkaneX · Nov 27, 2013 at 10:29 AM

No need to know location, if language is your primary concern.

On standalone you have regional settings in Windows, and I guess some similar settings in Mac/Linux. On mobiles, you can select language chosen by user. In web browsers, you can use navigator.userLanguage (you have to call it in context of web page, not in Unity).

In your case regional settings is a best option, but as far as I know, there was some bug in retrieving this in Mono. Please read this question and answer for additional info and workaround.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Make a km or metter the user make IRL 0 Answers

Child location problem 1 Answer

Where can i find readymade AI scrips for free? 0 Answers

How do I move the Asset Folder to another drive? 0 Answers

Scripts named 'Grenade.js' exist in multiple locations 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges