3
\$\begingroup\$

As I move the main camera in my Unity game towards the left or right, the camera just stops rendering any of the tilemaps in the scene.

Here, the camera is at x = 25.7, and the preview isn't showing anything (Neither is the game view), but as I move the camera inwards towards x = 24.7, everything renders normally...

I can clearly see the tilemap objects in the scene view though...

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

I found the problem! The camera doesn't render the objects even though they exist because the camera moves far enough away from them, to not render.

The Tilemaps I create are centered at 0,0 (even the ones that generate the tiles far away). So when the camera moves a certain distance away from them, it just stops rendering the tilemaps.

To fix it, I just had to centre the tilemaps closer to the place they would be generating their tiles (chunkNo * chunkSize).

This fixed the issue!

\$\endgroup\$
2
  • \$\begingroup\$ Thank you for answering your own question. Somehow Unity was setting impossibly low chunk sizes by default, even though my tilemaps are never far from zero; this answer helped immensely! \$\endgroup\$
    – kungphu
    May 8, 2020 at 6:50
  • \$\begingroup\$ you can share your code ? please \$\endgroup\$
    – Qusdrok
    Dec 16, 2020 at 6:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .