mapbox / mapbox-unity-sdk

Mapbox Unity SDK - https://www.mapbox.com/unity/
Other
725 stars 210 forks source link

Static Images API doesn't work in Apple M1 #1835

Open asevillanom opened 2 years ago

asevillanom commented 2 years ago

I'm working with Unity 3d and MacBook Pro M1 and I have a game that request static images from Mapbox. In Unity editor the images are loaded fine but when I build for iOS device with Xcode images don't load. Some months ago works fine in iOS devices with my old MacBook Intel, but not now. How can I fix it? Is there any incompatibility between Static Images API and Apple M1?

This is the url I'm using:

url = "https://api.mapbox.com/styles/v1/mapbox/streets-v11/static/" + fixLon + "," + fixLat + "," + zoom + "/600x600?access_token=" + key

The console of Xcode shows this error: HTTP/1.1 422 Unprocessable Entity

And this is the code: `UnityWebRequest www1 = UnityWebRequestTexture.GetTexture(url); yield return www1.SendWebRequest();

    while (!www1.isDone)
    {
        Debug.LogError("loading map...");
        yield return null;
    }

    if (www1.isNetworkError || www1.isHttpError)
    {
        Debug.Log("Error while Receiving: " + www1.error);
    }

    else
    {
        yield return new WaitForSeconds(0.5f);
        maprender.material.mainTexture = ((DownloadHandlerTexture)www1.downloadHandler).texture;
    }`

Note: If this is a bug or support ticket, please provide the following information:

brnkhy commented 2 years ago

@asevillanom I haven't seen this issues before and I honestly don't have much idea what might be wrong. Does the url work when you use it via browser? SDK uses Unity methods for all texture operations :(