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 /
  • Help Room /
avatar image
0
Question by CHG_Eve · Jun 09, 2016 at 01:43 PM · uibuttononclickpanel

UI Button positioned outside Panel parent not registering click event (Unity 5.3.4)

I have a weird problem with a UI Button:

The UI button is the child of a UI panel. The panel is positioned outside of the screen. The button itself is the only thing visible on screen and therefore positioned outside of its parent panel (and anchored to one corner of the panel). When the button is clicked, the whole panel plus button moves up (on screen) and with another click it moves down (outside of screen, only button visible).

Last time I worked on the project everything worked fine, but today the button does not register a click event anymore. I haven't changed anything since then.

When I move the button object outside the panel in the hierarchy, so that they are not related anymore, it does work again. But I don't get why...because two days ago it did also work when the button was a child to the panel. It has to be a child, so the button will move with the panel and is always relatively positioned to it.

I checked: The code and animations work properly, I have a canvas, an event system and all other buttons work. Also the mentioned button is not covered by anything else and should be the last thing rendered.

Has anyone an idea what the cause of the probleme could be?!

Comment
Add comment · Show 4
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 Mmmpies · Jun 09, 2016 at 02:03 PM 0
Share

The most likely cause is you have another UI element over the button. If you detach the button I'm betting this moves it lower down in the hierarchy and the bottom of the hierarchy is foremost as far as the UI goes. Try moving the panel with the button attached to the lowest sibling.

That means the lowest UI element for the parent object, so if the parent of the panel is a canvas then any direct child objects of that canvas are the panels siblings so move your button panel to the bottom of that list.

Like wise if you have other siblings of the parent for that panel make the buttons-panels-parent the lowest element for that parent-parent object.

I'm not even sure I understand what I mean with that last bit!

But lower in the hierarchy is more to the front on the UI.

This would be easier with an image but not got access to Unity right now.

avatar image CHG_Eve Mmmpies · Jun 09, 2016 at 02:27 PM 0
Share

Thanks for your answer. I attached two screenshots so you can see what I mean. When I asked the question I already tried that bit out: The panel is the last thing in the hierachry and the button is the last child of the panel. This way it does not register the click. When I move the button outside the panel (e.g. above it), it does register the click successfully.

It's really weird, technically it should work but it doesn't and I'm out of ideas now! :(

First pic = not working | Second one = working

not-working

working

button2-working.png (87.9 kB)
button1-not-working.png (89.5 kB)
avatar image CHG_Eve CHG_Eve · Jun 09, 2016 at 02:42 PM 0
Share

I also tried it now with a completely empty scene with only the (empty) panel and the one button inside the canvas and its still the same. So there is definitely no other object or script interfering.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by CHG_Eve · Jun 09, 2016 at 03:20 PM

Ok, i finally found the problem after reproducing the whole thing in a new project:

I had (for whatever unknown reason) a canvas component on my UI panel that did not serve any purpose. After removing the canvas component everything worked again, even if the button was a child of the panel.

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

78 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

Related Questions

How can I generate and setup buttons via code 1 Answer

Get value in button OnClick() 1 Answer

Slide-Out Panel Animates on Button - How to Animate on Swipe Motion on Mobile? 1 Answer

is it possible to have two on click events in one button 1 Answer

UI Button OnClick Only Works the First Time 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