- Home /
How to performantly render 1000s of sprites?
I am drawing a hex map for a 2D game. I didn't want to create 10000 SpriteRenderer-s for 100x100 hexes, so instead I create a mesh with my sprite sheet as a texture, and manipulate UVs to get the right sprite on each hex. Works perfectly.
However, if I want to overlay anything on top (e.g. a unit), I get tons of z-fighting and things go over and under the main mesh with camera movement (even with clipping/etc. reduced as much as possible).
Unity sprites are just quads (I'm told), and yet they have sorting layers and are always displayed in the correct order. HOW IS IT DONE? Is there a special shader, or some other trick? Does it actually re-generate the image with all the sprites overlaid in correct order, to put it on the quad? What does it do?!! I'm tearing my hair out here.
Or otherwise, what should I do? I am thinking about drawing them way above the map and cheating with position/scale to make them look like they are where they need to be on the map but that's just ridiculous. Any other way?
Your answer
Follow this Question
Related Questions
Draw/generate shape as 2D sprite? 0 Answers
How to make 3D colliders on sprites? 0 Answers
Gaps sometimes appearing between 2D sprites 14 Answers
How do you bend a 2d texture in 3d?,How do you bend a 2D object in 3D? 0 Answers
Can I use a Mesh as a Sprite Mask? 0 Answers