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 /
This question was closed Mar 06, 2015 at 03:25 PM by meat5000 for the following reason:

The question is answered, right answer was accepted

avatar image
2
Question by julmot · Mar 05, 2015 at 07:42 PM · uiguibuttonpanel

Button onClick events will not be triggered

Hello,

I have a problem. In a "Canvas" element (GUI) I have a Panel. Inside this Panel I have a Button called "CloseBtn". This button should call a function called "hidePanel" in the "Panel" script assigned to the Panel. So I added the onClick event trigger in the inspector:

CloseBtnInspector

Unfortunately the HidePanel function will never be called. I also tried to create a empty Gameobject and added a script with a "test" function. Even then the test function will never be called.

So I thought a possible workaround would be to call the function manually with a onClick() function. So I created a script and assigned it to the button. But even then the "onClick" function will not be called:

onClick

I don't get any errors in the console. What is the problem here?

closebtncsharp.png (11.5 kB)
closebtn.png (53.7 kB)
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 AlwaysSunny · Mar 05, 2015 at 07:40 PM 0
Share

First guess is that your panel (or some other UI element) is "above" your buttons. (The panel is superior to your button in the scene hierarchy, and is consu$$anonymous$$g your clicks.) If so, re-order your buttons and interactables to the foremost position in the canvas hierarchy and see if that does it.

Do your other events invoke? (Does the button change to its highlight color when you mouse over it? Looks like you're missing an image - this would be worth adding one to test.)

avatar image AmazingDeveloper2 · Mar 06, 2015 at 08:40 AM 0
Share

I don't see public method HidePanel in your code

1 Reply

  • Sort: 
avatar image
4
Best Answer

Answer by julmot · Mar 06, 2015 at 03:25 PM

The correct answer should be: make sure you have an EventSystem added to the hierarchy!

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

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

In game right click menu 1 Answer

UI Button multiple parameters 6 Answers

Move gameobject to button in new 4.6? 0 Answers

OnPointerExit not updating if container panel was SetActive(false) 2 Answers

Buttons not Clickable inside of ScrollView 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