Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 BugFighter · Feb 29, 2016 at 05:01 PM · uibuttononclickinteractable

UI Button not working

It seems strange, but I've rechecked this lots of times.

I have multiple buttons in my scene that are hidden and interactable is set to false until I change these two things by script. All buttons work fine except for one. I've tried rebuilding the button from another one that was working and just changing graphics and OnClick(). Still, this button doesn't work.

Both buttons are definitely called by the script, because the buttons show up right on time and the other button works. Also, I use sprite swap as button animation (should be visible if anything happens; other one is showing a change caused by hovering with the mouse).

What could I be missing?

Thanks a lot.

EDIT: I am using the most recent version of Unity on OS X (Unity 5.3.3), but the error occured before. It also happens in the built version.

Comment
Add comment · Show 2
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 Graphics_Dev · Feb 29, 2016 at 05:39 PM 0
Share

What exactly is the problem? Are you getting any errors? Is interactable enabled?

avatar image BugFighter Graphics_Dev · Feb 29, 2016 at 06:55 PM 0
Share

No errors, interactable is enabled.

I just seems like this one button doesn't receive any input. So no transitions (on hover/click) and none of the actions in the OnClick() component are getting executed on pressing the button.

2 Replies

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

Answer by phil_me_up · Feb 29, 2016 at 08:15 PM

In your scene you should find you have an 'EventSystem' object. Whilst playing the game, inspect this object and towards the bottom of the inspector you will see some debug information, which includes what the mouse is interacting with at any time. Hover over the problematic button and try clicking it. Is it actually trying to click something else (i.e. is some other component blocking the input?)

Comment
Add comment · Show 3 · 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 BugFighter · Feb 29, 2016 at 08:54 PM 1
Share

I have an EventSystem and I used inspector and debug console to check the button. (Button is - except for his graphic attributes and OnClick() methods - identical to a working button).

I've tried hiding all other UI objects to see if there is something blocking it, but it didn't occur to me to check the ones beneath it in the hirarchy. Due to the nature of Unity drawing the upper ones first, the ones below are rendered above. I feel a little stupid for disregarding this detail of Unity.

Thanks

avatar image MileSplit · May 13, 2017 at 03:50 PM 0
Share

Wow i never knew you could do that! thanks.

avatar image remsleep · Jun 26, 2017 at 08:43 PM 0
Share

Great answer, thank you!

avatar image
1

Answer by Miyed · Oct 23, 2020 at 06:24 AM

I know this doesn't directly answer your question, but in case it helps others in the future.
In my case, I had the following structure setup in the Hierarchy: Canvas->Panel->Button and for some reason, the canvas gameobject was missing a Graphic Raycaster component. Therefore my button (and other UI children of the canvas) were un-clickable.

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

59 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

Related Questions

Unity 5.0.2f1 UI Button OnClick Function 6 Answers

UI Button generated in runtime OnClick event 0 Answers

Callback when 'interactable' is toggled on a UI button? 0 Answers

Play sound on noninteractable / disabled / grayed out button 1 Answer

How do change UI.button onclick states(off, editor and runtime, runtime only) via script? 0 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