mapbox / mapbox-unity-sdk

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

Not compatible with Unity 6 #1924

Open tomCarnevale opened 4 months ago

tomCarnevale commented 4 months ago

Opening the examples with Unity Version 6000.0.10f1 causes an error when attempting to create any textures. User is met with pink error textures.

Failed to create texture because of invalid parameters.

From UnityTile.cs Line 294

if (_rasterData == null)
{
    _rasterData = new Texture2D(0, 0, TextureFormat.RGB24, useMipMap);
     _rasterData.wrapMode = TextureWrapMode.Clamp;
}

However, this issue is not present in 2022.3

tomCarnevale commented 4 months ago

I had some additional problems in my own project, but I was able to resolve this issue by instantiating the Texture2D with a width and height of 1, since apparently the API was updated to disallow widths and heights of 0.

Cannot be sure if this is a reasonable fix for release, but give it a try

maria-ny commented 2 months ago
_rasterData = new Texture2D(1, 1, TextureFormat.RGB24, useMipMap);

Thank you, @tomCarnevale, your solution worked for me!

AndresG123 commented 1 month ago

worked for me! Unity 6 and MapBox its ready!

liquidbuddha commented 1 month ago

Brilliant. This fix worked for me as well. Thank you.