• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by ZuPe2112 · Jun 13, 2015 at 01:24 PM · spriterenderingoverlaporderoverlay

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?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Johnz1234 · Jun 13, 2015 at 05:22 PM

change the layer valvue to background 0 to ground 3 to player 2

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

overlaying object problem 0 Answers

Setting renderQueue doesn't appear to change draw order 1 Answer

Unity2D strange green line under sprites 0 Answers

Shader queue tags not working...? -1 Answers

Sprites that overlap if tall enough 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges