• 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.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

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

unity 2018.3.12f1 Button OnClick call function on another instance? of script 0 Answers

UI Buttons without blocking raycast 0 Answers

How do I make a UI Buttion play an Animation when pressed? 0 Answers

AddListener not working after build 0 Answers

Button in one panel affects another? 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