Ailef
Ailef

Reputation: 7906

Displaying Google Maps in Unity on mobile devices

Is there a way to display Google Maps (even other maps should be ok) in Unity 3D but on mobile devices (both Android and iOS)?

Even paid plugins are ok.

Upvotes: 4

Views: 14322

Answers (3)

Taras Leskiv
Taras Leskiv

Reputation: 1875

My plugin Google Maps View does exactly this: https://assetstore.unity.com/packages/tools/integration/google-maps-view-82542

Works on Android and on iOS. It is a native view so the performance is great. The only limitation is that you can't display Unity scene objects on top of it.

Upvotes: 0

Ilya Builuk
Ilya Builuk

Reputation: 2179

Some time ago, I started to work on map based framework for unity3d: ActionStreetMap. The current version (0.7) supports the following features:

  • Rendering of different models (e.g. buildings, roads, parks, rivers,POI, etc.) using OpenStreetMap (OSM) data for given location on the fly by terrain tiling approach.
  • Offline and online modes.
  • Non-flat terrain with Data Elevation Model (SRTM) files.
  • Easy customization by mapcss-like files.
  • Modification of city environment (terrain craters, corrupt buildings, etc..).
  • Fast 2D overview mode for large area.
  • Targeting mobile (VR?) devices.

You can find web demo builds here.

Upvotes: 1

Jerdak
Jerdak

Reputation: 4056

You can use Unity's WWW.texture and Google's static maps API to render their map as a texture on a GameObject. For my example I used a plane, nothing fancy. The image URL I used in my example was taken directly from the Google API page. One note, you'll need to use your own API key, I've left that value blank. If you run my example without the API key, you'll get a 403 error.

using UnityEngine;
using System.Collections;

public class GoogleMaps : MonoBehaviour {

string exampleUrl = "http://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,"+
                    "New+York,NY&zoom=13&size=600x300&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794"+
                    "&markers=color:green%7Clabel:G%7C40.711614,-74.012318"+
                    "&markers=color:red%7Ccolor:red%7Clabel:C%7C40.718217,-73.998284"+
                    "&sensor=false";
string key = "&key=YOUR_API_KEY"; //put your own API key here.

 IEnumerator Start() {
    WWW www = new WWW(exampleUrl+key);
    yield return www;
    renderer.material.mainTexture = www.texture;
}
}

Upvotes: 5

Related Questions