Sprite Manager2 : manually changing depth sorting without a manager

Hello! I asked this on the SM2 forums, but I thought I would try here too.

I’m trying to make an isometric game with lots of sprites (some animated, some not). Because of the iOS texture size limit, many of my animated characters must be super sprites to fit them all.

My main issue is the age-old z-sorting problem that isometric games have, where some sprites should be ‘behind’ others based on the location of the footprint (not the sprite itself). I’ve successfully calculated the z-order index, and I can even implement exactly what I want if I use simple packed sprites and a single sprite manager, using ‘setDrawLayer()’. However, all of my characters and buildings and whatnot will never fit on a single texture for a single sprite manager.

My question is how to manually force depth sorting for multiple super sprites that are not associated with a sprite manager. I understand that currently, SM2 will automatically do this based on the distance from the sprite to the camera (which is almost what I need), but I need it to base this on the distance from the footprint to the camera (which i have already computed).

Does anyone know where I might be able to modify SM2 to do this?

Thanks,
Peter

In short, you can’t because sprite manager creates a composite mesh from all its managed sprites and uses the bounding boundary’s center as its position. You will see a yellow box with a + symbol, the + is where at in the scene unity considers the composite mesh at. So you can’t move non manage sprites to interpenetrate within the boundary itself. Think of sprite manager as creating a single mesh as opposed to rendering out x sprites.

I also do not think I would use a sprite manager for this, Unity is pretty good at determining the batch draws dynamically provided that in a given boundary all sprites belong to the same material. I would probably make your zsort slightly smarter.

Sprite Manager does have a layer property which determines the sorting order of sprites within the same sprite manager.

If you don’t bother with sprite manager though, make the z coordinate as a function of height from base floor line. z(y) = (depth spacing) * y; and move all your pivots to bottom center and the number of draw calls will be based on how many bounding zones are made up of sprites from 1 material.

Hope that helps

Thanks, but actually, I tried all of those things to no avail. What finally ended up working for me was just modifying the renderQueue number on the materials associated with each sprite at runtime. It was way simpler than I thought it had to be.

-Peter