Make projectiles appear over friendly units but not enemy units

I’m making a RTS type game and am trying to make projectiles be drawn over friendly units (so they don’t appear to be shooting each other).

I tried to do this using cameras but then either the projectiles are also drawn over enemy units or enemy units are being drawn over friendly units. Is there a way to make it so friendly and enemy units interact normally, projectiles and enemy units interact normally, but projectiles appear in front of friendly units?

It depends what you mean by “make it so friendly and enemy units interact normally”. It seems like you want projectiles to go on top of friendly units, but behind enemy units, which implies

  1. Enemy
  2. Projectiles
  3. Friendly

But you also want your friendlies to render on top of enemies? That would put them on top of projectiles as well. What happens when all three are on top of each other? I don’t think what you’re after really makes sense.

If you do decide on an order, you don’t have to use multiple cameras, you can set the material’s render queue (use 2001 for the bottom one, then 2002, then 2003. Or if you’re using 2D sprites, use the Sprite Renderer component and use the Order in Layer property.