layers on instantiated prefabs

I have a gameobject “player” in whose code i instantiate a prefab (fireball projectile). Although I set the player to layer “player” (layer 8) and the prefab in layer “projectiles” (layer 9), when running the game the player is over, i.e. on foreground, the projectile.

Why is that? How can I solve this?

Thank you

The issue might be the Sprite Renderer Order In Layer rather than the Layer Mask.
5247284--524078--upload_2019-12-4_16-34-0.png

You can set the Player’s sorting layer to something like 10 and the fireball will be underneath the player always.

1 Like