- Home /
Unity2D sprites overlapping
Hello, i'm developing a 2D game and have a problem about overlapping prefabs.
I have two prefabs with different sprites; each of them has same Layer and Material (Sprite-Default).
Prefab A has greater Z value than Prefab B. And i also assigned a greater Order in Layer to Prefab B. This should make Prefab B overlay on Prefab A.
Nevertheless, their display behaviour is somekind of random (sometimes one overlays on the other, or vice versa). Also, in the editor Prefab B is always displayed behind (and so hidden by) Prefab A, wheter or not i change their Z values.
Please, does anyone know how i could fix this?
Answer by Johnz1234 · Jun 13, 2015 at 05:22 PM
change the layer valvue to background 0 to ground 3 to player 2
Answer by ZuPe2112 · Jun 15, 2015 at 03:48 AM
Thanks but it didn't work. Anyway, I finally figured it out. The problem was about Prefab B: it has a child sprite, i had to set its order in layer too.
Your answer
Follow this Question
Related Questions
overlaying object problem 0 Answers
Checking for overlaping sprites in an array 1 Answer
2D Sprites border overlap . 0 Answers
Setting renderQueue doesn't appear to change draw order 1 Answer
Unity2D strange green line under sprites 0 Answers