- Home /
Drawing sprites in front of meshes
I'm making a 2.5D shooter, so I'm using meshes, but the bullets are sprites. I need the bullets to appear on top of everything, without clipping into enemies and other stuff. I can't set their z coordinates too apart, because my camera's projection is set to perspective and it's in 45º.
I searched for an answer and saw that some people used to set sorting layers to mesh renderers through code, so they could render sprites in front of meshes. But it seems it doesn't work in recent versions.
Is there another way?
EDIT: I think this game is a good example of what I'm talking about. The bullets are always at the foremost of the screen, no other element hides them. Sometimes the camera is slightly behind the player, so we can see it's not about depth.
Answer by CrisOliveira · Sep 03, 2020 at 09:10 AM
I'll answer myself in case other people have the same question:
Have a first camera with culling mask set on the bullets' layer and a child camera set on everything else.
Thank you! This is very helpful. This might help others in the future too: https://www.youtube.com/watch?v=bbnVpPiQ_rU