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
1
Question by shoffing · Feb 21, 2015 at 07:59 PM · uiunity 4.6hierarchysorting order

How to achieve this desired render order with the new 4.6 UI?

In Unity's new UI system, the z-ordering is determined by hierarchy (top-to-bottom). Take a look at this picture and you can see my problem with this:

alt text

I need the WeldIndicators to render on top of the brains, and I need the PartNameDisplays to render on top of everything. But, the PartNameDisplays need to be children of the brains because they're labels and the brains can move around.

One solution I can think of is re-organizing the hierarchy so it does brains > WeldIndicators > PartNameDisplays, and setting the position of the PartNameDisplay every frame in an Update() loop. This is suboptimal because it would remove the parent-child relationship of the brain->PartNameDisplay that is logical for an object and its label, not to mention setting the position every frame seems like a waste of resources.

Another solution is to give each PartNameDisplay its own Canvas, and set their z-order to be on top in that way. But that seems like it would be inefficient and, again, illogical to have dedicated Canvases just to render single elements.

Unless anyone can provide a better option, I think I will be using the first solution and manually setting the position of the PartNameDisplays every frame. Thank you for any ideas.

z-index-problem.png (30.7 kB)
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 bigticket21 · Sep 01, 2015 at 07:26 AM

@shoffing How exactly are you ordering the brains? Also, how are they going to move? Where are they going to move to?

If I was you, I'd try experimenting by putting a Vertical Layout Group on your main parent (EditorPartsContainer in this case). It will order the brains automatically while also giving you the option to leave space between them. Try doing that. Just remember to put a Layout Element script on your brains, so you can change their sizes (if you use Vertical/Horizontal layout group on their parent).

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 andsee · Sep 01, 2015 at 09:28 AM

If you're after overlap then my solution to issues like this has been to write a script which copies the position of an object to another. This allows me to have the indicators to make use of the hierarchical layout, so dragging a brain causes the indicator to move with it.

In this scenario I would duplicate the wield indicators (you can disable the image component on the originals) and place them all in an object 'RenderAfterBrains' which is placed after the brains.

The script then modifies the position of the duplicates whenever any of the originals move. It's far from ideal, but the only solution I've come up with.

Let me know if this approach would be suitable for you and I'll see if I can grab the code I use.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

UI is not visible on Android lollipop after upgrading from 4.6 to 5. 0 Answers

UI Bring to front without modifying hierarchy 1 Answer

Simple UI not appearing once deployed to iOS (4.6.2) 1 Answer

A game entirely made with the new UI ? 1 Answer

Unity 4.6 Mask Component on Android doesn't work properly. 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