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 Tomer-Barkan · Mar 11, 2015 at 05:34 AM · uigui4.6

4.6 UI - overriding order / depth

So in 4.6 UI, the decision of which UI element is drawn on top of another depends on the hierarchy, but I'm looking a way to override this.

I have an inventory panel, displaying a bunch of items in a table. Each item has an image, which doesn't overlap other items. In addition, each item has a text component that is displayed when hovering the item, and this component does overlap other items. I want the text component to always be on top of the item images, even other items.

So the hierarchy would look like this:

 Image 1
   Text 1
 Image 2
   Text 2

And as such, Image 2 will be on top of Text 1. How do I override this so that all Text elements are drawn on top of all Image elements? I tried modifying Z position but it didn't help. In NGUI this would be easy by setting the Depth parameter of Text higher than that of Image.

Edit: Here's a screenshot of the problem

alt text

The bow & it's text are Item 1 in the hierarchy above, and the uzi is item 2 (it's text is disabled)

img.png (23.1 kB)
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 Kumo-Kairo · Mar 11, 2015 at 07:34 AM 0
Share

Can you add an image of your problem?

avatar image Tomer-Barkan · Mar 11, 2015 at 07:47 AM 0
Share

Sure. Added.

avatar image Tomer-Barkan · Mar 12, 2015 at 12:33 PM 0
Share

Any Ideas? I'd prefer not to instantiate a popup every time...

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by DiegoSLTS · Mar 12, 2015 at 01:08 PM

I don't know any method to change that drawing order, the only solution I can think of is using only one text box at the end of the hierarchy and displaying and moving it over the hovered element.

You don't need to instantiate a popup every time, you can use the same and just move it and change the text according to the hovered element before showing it.

Comment
Add comment · Show 2 · 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 Tomer-Barkan · Mar 12, 2015 at 01:26 PM 0
Share

Yeah, thats what I meant, I was just thinking this is something that must have a solution with the UI without having to reposition children... I'll leave it open a bit more to see if anyone can come up with a solution for setting the depth, as could be done in NGUI.

avatar image DiegoSLTS · Mar 12, 2015 at 01:47 PM 0
Share

The only thing I know that affects the drawing order in UI elements is the "Sort order" property of the Canvas component.

Another solution might be to move the hovered element as the last child of the parent element with code, it will keep it's position in the scene if it's not a child of a Grid/Horizontal/Vertical Layout component.

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

How to change Normal color, Highlighted color etc. in 4.6 buttons with code 2 Answers

Move gameobject to button in new 4.6? 0 Answers

[4.6] Input field password string value is ************ 1 Answer

4.6 UI transfer between Menu pages 2 Answers

How to make slider load variable on start 1 Answer


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