mapbox-unity-sdk icon indicating copy to clipboard operation
mapbox-unity-sdk copied to clipboard

Not compatible with Unity 6

Open tomCarnevale opened this issue 1 year ago • 4 comments

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 avatar Jul 16 '24 18:07 tomCarnevale

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

tomCarnevale avatar Jul 18 '24 16:07 tomCarnevale

_rasterData = new Texture2D(1, 1, TextureFormat.RGB24, useMipMap);

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

maria-ny avatar Sep 18 '24 11:09 maria-ny

worked for me! Unity 6 and MapBox its ready!

AndresG123 avatar Oct 19 '24 14:10 AndresG123

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

liquidbuddha avatar Oct 21 '24 12:10 liquidbuddha

@AndresG123 did u manage to build that on Unity6? i get a "Building Library\Bee\artifacts\Android\d8kzr\libil2cpp.so failed with output: ld.lld: error: undefined symbol: GetBlendShapesInfo" and can't get the end of it

VisnevschiV avatar Jan 09 '25 20:01 VisnevschiV

@VisnevschiV Yes, im using unity 6 and mapbox function perfect, although im working for IOS build not for Android at this moment

AndresG123 avatar Jan 09 '25 21:01 AndresG123

@AndresG123 would you mind to share with me the versions of ARCore/ARFoundation/ARKit/Unity/MapBox you are using? i expect the problem to be with one of them

VisnevschiV avatar Jan 10 '25 10:01 VisnevschiV

That fix in UnityTiles.cs solved my errors, and it's now working, but my maps are still rendering pink (only the map, the buildings are ok). I'm trying to upgrade my app from 2022.3, and tried the render pipeline converter, but I guess that doesn't work on the maps as they are loaded later??

davide1a avatar Jan 10 '25 14:01 davide1a

@davide1a if you use the Map prefab, go AbstractMap(Script) > General > Others > TileMaterial . tehre is a Terrain Material, select that and change it to unlit, or lit, whateer works best for ur needs, it should fix the problem

VisnevschiV avatar Jan 10 '25 14:01 VisnevschiV

Thank you! I was searching for ages trying to find the material it used, but it wasn't showing up in the project window.

davide1a avatar Jan 10 '25 15:01 davide1a

@davide1a Np, now welcome to the "how do i get a build out of that" team

VisnevschiV avatar Jan 10 '25 15:01 VisnevschiV

@davide1a Np, now welcome to the "how do i get a build out of that" team

That's why I had to upgrade it to Unity 6! Got it all working on my phones, and went to try and load it onto Google Playstore to find out I have to use API level 34 now. So hopefully not too much more headache now...

davide1a avatar Jan 10 '25 15:01 davide1a

@VisnevschiV I take that back!!! If you have any ideas on - this thread I'd appreciate it.

davide1a avatar Jan 10 '25 18:01 davide1a

OK boys, i managed to make it work on unity6. Please note that i also did some random stuff before getting to my solutions, and i am not sure if any of that worked, but here is what i have on Unity6.0.33f1:

  1. First ensure your Android building stuff is not ReadOnly. Not sure if it's important but i lost some time on it and it might be part of the solution (u can try to skip that)
  2. I updated all the packages to last, but do not use just the AR Package, as magicLeap was getting in the way. (u can try to skip that too, idk if it's important)
  3. I entered Assets>Mapbox>Core>plugins>Android and deleted all .aar files.

Settings Notes: i have minimum API to 29 and target to 33. I use ARM64 . I also use all the reccomented JDK SDK ,NDK and Graddle. Hope it Helps anyone

VisnevschiV avatar Jan 17 '25 13:01 VisnevschiV

Original issue with texture sizes was a good catch and thanks to @tomCarnevale for that but Api level and libraries are a different issue.

I entered Assets>Mapbox>Core>plugins>Android and deleted all .aar files.

this might be against the Mapbox Term of Service and I advice against that. I understand SDK not supporting newer versions of the Android api but that's a problem we are looking to solve and removing Mapbox libraries isn't a good option.

I suggest checking talks at the end of this ticket; https://github.com/mapbox/mapbox-unity-sdk/issues/1912

I'll close this ticket just not to mislead anyone.

brnkhy avatar Jan 17 '25 19:01 brnkhy