Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 cdrandin · Nov 04, 2015 at 03:55 AM · collisiongui

How can I keep a UI element in the front while keeping hierarchy strict?

SO a quick run down. I am using an object which is a UI Dropdown Menu.

I have so far setup my UI elements in such a way that it is strictly hierarchical for organization. Now my question is there anyway I can get it to display at the upfront most way or do I have to reorganize the hierarchy to force it to work. I want to keep the hierarchy the same as it just neater and easy for prefabs to workout.

I checked on another post about this issue and the solution was to drop a Canvas component on the object, however that did work visually, but none of the buttons would respond.

Attached is a picture of the current hierarchy involved as an example. hierarchy

capture.png (13.6 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
Best Answer

Answer by npatch · Nov 04, 2015 at 08:12 AM

You can't do hierachy by role under Canvases. The reason being that the order of the transforms makes up the order with which the UI elements are drawn.

back_button will be drawn before title_text.

The elements under item1_edit will be drawn after the elements of item1_dropdown.

So if things aren't working for you, it's probably because you are using the wrong logic for organizing your UI elements.

It's best if you don't drop Canvases inside Canvases. You could have Canvases in the same depth(same parent) and make sure they have different distance from the camera, if you want to keep things as they are.

Also keep in mind that if you have UI elements with nested overlapping graphics and lose pointer events in the smaller graphic, chances are it's used up by the first graphic the pointer encounters.

Comment
Add comment · Show 6 · 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 cdrandin · Nov 04, 2015 at 06:03 PM 0
Share

So, from the provided picture above, how would you reorganize them to have the dropdown display properly? Don't need to show all of them just ones pertaining to dropdown if that is alright with you. I thought I had an understanding on the UI depth with hierarchy but I suppose not. The approach I took initially was to parent the objects as if they were actually "in-game" objects which seems to not work for a UI-basis.

avatar image npatch cdrandin · Nov 05, 2015 at 08:18 AM 0
Share

Depends on what you want to show above the others and what kind of editing you do in the item1_edit group.

avatar image cdrandin npatch · Nov 05, 2015 at 06:56 PM 0
Share

So far the text do not worry about overlapping one another. The main issue I want to resolve is having the dropdown be the top most UI visible over all other UI elements.

Show more comments
Show more comments
avatar image
0

Answer by meat5000 · Nov 04, 2015 at 08:36 AM

http://docs.unity3d.com/ScriptReference/Transform.SetAsLastSibling.html

I could be wrong but this sounds like what you need.

There is also a Pos Z entry in the rectTransform. This moves elements into and out of the canvas.

Comment
Add comment · Show 5 · 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 npatch · Nov 04, 2015 at 08:39 AM 0
Share

Isn't it a bit of a waste to change indeces at runtime when you can change the order at design time? $$anonymous$$oreover it should make it easier for you to see problems of occlusion between elements.

avatar image meat5000 ♦ npatch · Nov 04, 2015 at 09:15 AM 0
Share

This simply brings the element to the front on screen. $$anonymous$$akes it draw last to stay on top.

avatar image npatch meat5000 ♦ · Nov 04, 2015 at 09:19 AM 0
Share

I know what it does, what I'm saying is, he might be using the wrong way of organizing things so this could get messy if it's needed in multiple places. If it's just one element that's having a problem okay, but I think it's better to change his way to benefit in the longrun. What do you think?

Show more comments
avatar image cdrandin · Nov 04, 2015 at 06:01 PM 0
Share

These are great I will definitely try them out. For the time being this specific instance of UI elements is a one time deal as far as I am aware of, however in regards to the dropdown menu UI I will have better practice in organizing the UI elements.

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

46 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

Related Questions

Coin pickup script not working..? 1 Answer

Trying to get this coin system to work to no avail 1 Answer

Problems with OnTriggerEnter 1 Answer

activate gui on trigger enter 1 Answer

Enable a GUI texture after player collides with another object 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