유니티에서 구글 맵 활용하는 방법 url 에러

조회수 3546회

Unity에서 구글지도를 활용하려고 합니다.

에셋들이 몇몇 나와있지만 직접 해보려 합니다.

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%7C40.718217,-73.998284&key=키 입입력 완료.";
        loadingMap = true;
        WWW www = new WWW(url);
        yield return www;
        loadingMap = false;

        gameObject.GetComponent<Renderer>().material.mainTexture = www.texture;
    }
    void Start()
    {

        StartCoroutine(GetGoogleMap());
    }
}

위와같은 코드로 작성을 하였습니다만, 첫 째 방법은

You are trying to load data from a www stream which had the following error when downloading. 403 Forbidden 에러가 나더군요.

url 정보가 잘못된 것 같은데 맵 정보를 따올 수 있는 주소를 찾을 수가 없습니다.

혹시 경험해보신 분들이 계신다면 응답바라겠습니다.

  • (•́ ✖ •̀)
    알 수 없는 사용자

1 답변

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)