Real GPS in Unity

I am creating a location based app using real GPS information.

Needed features:
• option to use car or walk;
• the car cannot go in the opposite direction that the road goes

The orders will be:

  • first the person will choose a place to go
  • after I will get the GPS info, make a path finding
  • then I will send that person to the place that was chosen.

Please help me I have no idea of how I can do this.

1 Answer

1

I gather you want to build an app that has the same functionality as Google Maps. Most popular map databases have an API you can use, or you can purchase a 3rd-party Unity plugin, most of which will provide you with integration to one of those APIs. Search “maps” on Unity Asset Store for dozens of results.

If you want to use Google Maps API directly, you’ll first need to get familiar with the UnityWebRequest class (Unity - Scripting API: UnityWebRequest). You’ll have trouble with this unless you’re already familiar with web service basics (OAuth, RESTful Get/Post, JSON, etc.).

There are lots of Youtube videos on the topic. Search “unity web request” or “google maps API in unity”.

If you don’t have prior API programming experience in C#, GPS maps are a hearty project for a beginner. I recommend starting simpler. Try searching for a youtube video called “How to do REST API Get Requests in Unity - JSON/Unity Web Request Tutorial”. He uses API requests to pull random pokemon objects into a Unity project. If that’s a struggle, getting GPS map data will be much harder. Walk, then run.