- Home /
How to render multiple objects at one layer?
So, I have zombie object that splits on two objects: body and hand. On scene there are multiple zombies, and sometimes they overlay on each other. And when it happens, hand of one zombie shows on top of another. I thought that sorting layers can help, but I have multiple objects. Aslo I thought that merging textures can help, but it's too expensive.
Answer by asafsitner · Mar 13 at 12:41 PM
Look at the SpriteRenderer in the Inspector, and you'll see a parameter named Order in Layer:
You can also set it programmatically (but take note that it's actually called rendererPriority in script) so that whenever you instantiate a new zombie sprite, you increment this value (or choose some other way of doing it, up to you).
Thank you! I'll use it, but it should be noted that order in layer has constraint on the value of a variable between -32768 and 32767.