embed google maps into unity 3d

Can I use www class or some other way to fetch and display google maps into unity?

It is possible to fetch and display Google Maps into your own applications (it's not against the Terms Of Use, as SpikeX said), but you have to go about it in the proper way - i.e. sign up for a Maps API key, and abide by the strict terms and conditions which define what you can & can't do with the data they provide.

So - you can't just embed or "screen scrape" the google maps web page. :-)

As for whether it would be possible to create a working implementation of Maps in Unity, I'm not sure. I have a hunch that it might be technically possible, but it would be a very large undertaking.

An easier way (if you're targeting the webplayer) might be to use one of the existing implementations in Flash, and switch between flash & unity on your web page so that users use the Flash app to browse/select your map, and then you send image data to your Unity app via in-page-Javascript commands. (this is all possible!).

Here’s a simple implementation using Static Maps:

  1. Create a plane, point the camera at it, add a light source

  2. Add the following script to the plane

var url = “”;
var lat : float;
var lon : float;
var li : LocationInfo;

function Start () {
li = new LocationInfo();

lat = li.latitude;
lon = li.longitude;

url=“http://maps.google.com/maps/api/staticmap?center=“+lat+”,“+lon+”&zoom=14&size=800x600&maptype=hybrid&sensor=true”;

var www : WWW = new WWW(url);
yield www;

renderer.material.mainTexture=www.texture;

}

You don’t need the API key for it, and to my knowledge it doesn’t violate ToS

My plugin Google Maps View does exactly this: Google Maps View | Integration | Unity Asset Store

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.

No, this is not possible, and I wouldn't recommend it, as it's against the Google Maps Terms of Use.