Hi everyone,
I’m working on a 2D mobile game in Unity that uses Mapbox to display a real-world map. I’m trying to add a PlayerMarker sprite to the map, but it’s not showing up even though I’ve followed the usual setup steps.
Current Setup:
- Mapbox is working fine and the map renders correctly in the scene.
- I added a PlayerMarker GameObject with a Sprite Renderer (custom sprite).
- The Main Camera is set to:
- Position: (0, 10, 0)
- Rotation: (90, 0, 0) (top-down view)
- Projection: Orthographic
- In the GPSManager script, I’m setting the PlayerMarker’s position using:
Vector3 position = map.GeoToWorldPosition(new Vector2d(latitude, longitude), true);
playerMarker.transform.position = position;
What I’ve Tried
- Verified the Culling Mask includes the “Default” layer.
- Adjusted the Z-position of the PlayerMarker to ensure it’s on the same plane as the map.
- Changed the Sorting Layer to “Default” and set Order in Layer to 10.
- Temporarily forced a hardcoded position for the PlayerMarker (e.g.,
(0, 0.5, 0)
), but it still doesn’t render. - The map works fine with Mapbox’s default “Player” prefab, but replacing it with my custom sprite causes the issue.
Issue:
The PlayerMarker remains invisible, even when the position and camera setup appear correct. The Mapbox map itself renders fine.
Any ideas on what could be causing this? Could it be a layer, shader, or rendering issue that I’m missing? I’d really appreciate any suggestions or debugging tips.
Thank you in advance for your help!