Unity wants to use Google Maps.
There are a few sets out, but I'm going to do it myself.
using UnityEngine;
using System.Collections;
public class GoogleMapAPI : MonoBehaviour
{
private bool loadingMap;
string url = "";
public float lat =0.0f;
public float lon = 0.0f;
LocationInfo li;
public int zoom = 14;
public int mapWidth = 640;
public int mapHeigh = 640;
public enum mapType { roadmap, satellite, hybrid, terrain };
public mapType mapSelected;
public int scale;
IEnumerator GetGoogleMap()
{
url = "https://maps.googleapis.com/maps/api/staticmap?center=" + lat + "," + lon +
"&zoom=" + zoom + "&size=" + mapWidth + "x" + mapHeigh + "&scale=" + scale
+ + "&maptype=" + mapSelected +
"&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Clabel:C%7.7187,91871871828,7187,7187,7187,7187,98.98.98.98.98.98.98.98.98.98.98.98.98.98.98.98.74.0174.0174.01.74.";
loadingMap = true;
WWW www = new WWW(url);
yield return www;
loadingMap = false;
gameObject.GetComponent<Renderer>().material.mainTexture = www.texture;
}
void Start()
{
StartCoroutine(GetGoogleMap());
}
}
I wrote it in the same code as above, but the first method is
You are trying to load data from a www stream which had the following error when downloading. 403 Forbidden There was an error.
The url information seems to be invalid, but I can't find an address to retrieve the map information.
If there are people who have experienced it, please respond.
google unity c#
I put the code you uploaded into the 3D cube and executed it, and it was executed as below.
However, url is Google Maps API Static Maps API for the web You used the demo url shown in .
It seems that the url itself is wrong to send a request. First, type the url in your browser and try using it when it loads well.
611 GDB gets version error when attempting to debug with the Presense SDK (IDE)
578 Understanding How to Configure Google API Key
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
915 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
618 Uncaught (inpromise) Error on Electron: An object could not be cloned
© 2024 OneMinuteCode. All rights reserved.