Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 /
  • Help Room /
avatar image
1
Question by renomabum · Feb 08, 2019 at 03:35 AM · sorting layers

why sorting layers not working?

hello. i am having a problem about sorting layer. i totally get how it works.... its just that when i do it, it doesnot work. i have searched all questions thread and found few ways. but when i apply to my project it doesnt work.

i have a sets of gameobjects in 1 same sorting layer. by changing the sorting order it should have work. but it did not. based on the unity tutorial it should have worked. all the objects have sprite renderer. also all of them are under 1 same parent.

so i tried with the changing z value option.. still doesnt work.

i was using setting gameobject as last sibling originally, but a situation calls for me not to use it. ( by setting the gameobject as last siblings does bring the gameobject on top of the other ).

pls help me .. did i miss anything?

i even tried to create new project with just a bunch of image to test all the ways but result are the same.

thank you for your time.

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

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by renomabum · Feb 14, 2019 at 04:04 PM

Hi.. so after searching multiple threads , videos etc.. and not found the answer. I finally figured out a way around to achieve my goal.

i attached my gameobject with canvas component. ( dont forget to add graphic raycaster component aswell if you want your object to interact with pointer events.. eg. ipointerclick, ipointerenter etc..).

so, you can set your sorting order from inspector or via script.

however, you can only set the sorting layer of the top most parent in the hierarchy.

this means if the parent and child both have canvas component, i'm only able to set the sorting layer of the parent.

i tried setting the children's sorting layer to a different sorting layer than the parent via script, but when i enter play mode the sorting layer of the children still follows its parent's.

so with this i can only change the layer order of the children.

this is the codes i used for this.

         gameObject.GetComponent<Canvas>().sortingLayerName = "SortingLayerNameThatYouAlreadycreatedInTagsAndLayers";// use this to set sorting layer
         gameObject.GetComponent<Canvas>().sortingOrder = AnyInteger; // use this to set the order within the sorting layer

In Conclusion, This Question Is Still Not Answered. And I will still wait for answer or any explaination regarding my issue here. Because even after i achieve what i need, i still need to figure out why the previous method that i mentioned in the question did not work.

BTW, this is the unity tutorial video that i followed exactly ( created new project just to test out ) and did not achieve same results.

https://www.youtube.com/watch?v=ZzcyREamMUo

Cheers

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
1

Answer by unity_0GlwZ4j_Ggr0lA · Nov 01, 2020 at 06:11 AM

I had a similar issue but I found this article in the manual to be helpful:

https://docs.unity3d.com/Manual/2DSorting.html

It turns out I was using sprites that were rendered with differnt materials. This causes the problem.

Comment
Add comment · Show 1 · 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 Nguyentunglam · Jan 14 at 02:27 PM 0
Share

BREH, I'VE BEEN SEARCHING FOR THE ANSWER FOR THE WHOLE DAY, AND U JUST SOLVED THAT WITH JUST A SIMPLE ANSWER, thanks, I just need to remove the material and everything worked again, if the game I'm working on beco$$anonymous$$g a success, I'll reward u later XD

avatar image
0

Answer by Greywize · Feb 01 at 07:39 PM

To anyone running into this issue in the future, be aware of the order your sorting layers are in your project settings. The order matters! alt text


unknown.png (38.7 kB)
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.

Follow this Question

Answers Answers and Comments

166 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 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 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 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 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 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 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 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

SortingLayer Dropdown in Inspector 0 Answers

Transparency Sort Axis with rule tiles 0 Answers

My sorting layers keep getting messed up. Anyone knows how to fix this issue? 1 Answer

How to bypass Global Volume effects? 0 Answers

Sorting Order Question 0 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