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

Map Goes Black When Cloning

Open type-null opened this issue 4 years ago • 1 comments

I made a map prefab a child of a cube to be controlled in MRTK, and used code below to clone the cube with map when pressing a button. However, when it gets cloned, the clone one looks good but the original map becomes black. How can I fix this? Thanks.

Using RangeTileProvider. I found the issue is that after cloning, the raster data of the original one becomes missing.

// cube = gameObject;
Instantiate(cube, transform.position + new Vector3(0.5f, 0, 0), Quaternion.identity);
  • Unity version: 2020.1.16f1
  • Mapbox SDK version: v2.1.1

type-null avatar Dec 20 '20 18:12 type-null

@type-null that's an interesting case but I don't think it's SDK related really. Parent object is cloned, so everything under map should have same references to same textures. Even though new one does (so textures are still in the memory), old one doesnt... I wonder if Unity is calling OnDestroy on the original item. There is a method in AbstractMap to clear out map in that case. But then map is still there and only textures are missing right? Very strange 🤔

brnkhy avatar Mar 05 '21 21:03 brnkhy