How to add a Custom Player Location
Unity doesn’t detect your location automatically. To test your location in different areas, we created a DebugPlayerLocation script that lets you select different places to test. You can use the arrow keys to move the player around.
We’ve pre-populated this list with a bunch of major cities around the world. Of course, you’ll want to test your own locations as well. This is really easy to do with a few lines of code.
Find the DebugPlayerLocation.cs script
- Add your location name to the DebugLocation enum.
- Add the coordinates for the location to the m_debugCoords dictionary.
Just copy and paste the last item, then change the values for your location.
Use your keyboards arrow keys to move the player on the map
Make sure you have the “Keyboard Moves Player” checkbox selected.
How do I find my Coordinates?
You can find coordinates using most map services.
In Google maps, right-click on a spot and select “What’s here?”
Get a pop-up with the Latitude, Longitude coordinates.
Make sure the values are correct.
- South latitude and west longitude need to be negative.
- Many sources will report these as (lat)S, (lng)W
- for example, if you search Google for “Perth coordinates” you’ll get “31.9522° S, 115.8589° E. This needs to be translated to (-31.9522, 115.8589).
(arrow keys image by Simon Mettler from Noun Project)