Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 kbczst · Mar 01, 2014 at 04:57 PM · 2dspritesz axisrender order

Z order for GameObject

Unity native 2d proved a method to oder SPRITES in render depth by "sorting layer" and "order in layer" it is good enough for only one game object but if I have two game objects, they have the same sprites structure becouse they are cloned from same prefab, problem comes: how can I get the right result if one game object is overlaped by another?

eg: in prefab, 'A' sprite overlay 'B' sprite. game object 'a' and game object 'b' are both cloned from this prefab. I placed game object 'a' in front of game object 'b'(meanes 'a' have a minor z), so I expected 'a' overlay 'b' totally, but sprite 'b-A' overlaied 'a-B', in spite of the z order of game objects.

Comment
Add comment · Show 3
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 Linus · Mar 01, 2014 at 05:24 PM 0
Share

Order In Layer The overlay priority of this sprite within its layer. Lower numbers are rendered first and subsequent numbers overlay those below.

Change the order in the layer right after you have added the 2nd sprite to the game.

What is considered closer to the camera is up to you. I imagine comparing y values could be used in some 2D games to deter$$anonymous$$e what should be drawn as closer to the camera.

What kind of 2D game is it?

avatar image kbczst · Mar 02, 2014 at 02:25 AM 0
Share

a game of characters fight in a battle ground, 3 vs. 3, attack in turn, characters lower on screen is nearer to the camera. so comparing y value is a good way, but I have 50 parts with 50 sprites for one character, I must have a nice try to see if there is a performance problem.

thank you for the answer~~

avatar image kbczst · Mar 02, 2014 at 06:07 AM 0
Share

changing sortingOrder dynamicly is low efficent. my character will run on the battleground, so I have to caulculate it all the time. on my phone(Samsun 9082), Camera.Render cost 40ms+, framerate dorp to about 20, which is not acceptable

0 Replies

· Add your reply
  • Sort: 

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.

Follow this Question

Answers Answers and Comments

21 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Sprite quality decreased after adding 3d object to 2d game 0 Answers

How to mask sprites in 4.3? 2 Answers

Sprite Editor won't create files. 2 Answers

Rotating Produces Odd Results [Unity 2D] 1 Answer

2d sprite animation issue 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges