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 /
avatar image
0
Question by Kaz_Yamof · Sep 02, 2014 at 05:34 PM · uiguibutton4.6

IPointerClickHandler error

I was working just fine with the 4.6b17, when suddently I'm starting to get this error when I click on my buttons. They activate a method in other script passing a GameObject by parameter. If i use not my script, but some of the functions natively avaiable on OnClick event trigger, the error don't occurs.

Someone know what is this?

Error:

 Type IPointerClickHandler expected Button received. i:0. Object reference not set to an instance of an object
 UnityEngine.EventSystems.EventSystem:Update()
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 BBoldenow · Sep 02, 2014 at 09:19 PM 0
Share

I'm getting the same error - if I can figure it out I'll let you know.

avatar image Computerkid23 · Sep 03, 2014 at 10:03 AM 0
Share

Just came across this error hope someone can go into detail what it means

2 Replies

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

Answer by Gizmoi · Sep 03, 2014 at 10:06 AM

I also received this error. It was due to a NullReferenceException being thrown in the handler I had assigned to the button.

Check that the handler you have assigned isn't thrown any exceptions or errors. Either attach the debugger and step through the code, or comment out the code inside the handler and check if it runs ok without it. That should tell you what it is.

Comment
Add comment · Show 4 · 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 Kaz_Yamof · Sep 03, 2014 at 12:31 PM 0
Share

@Gizmoi thanks, was something just like that.

avatar image Kaz_Yamof · Sep 03, 2014 at 12:31 PM 0
Share

Well, I kinda of figured out what was going here. I was getting all components of a certain type using GetComponentsInChildren, and then by accessing a child gameobject with a common name in all of them, by transform.FindChild("test").

Sometimes (my logic fault's) I was getting an object that hasn't this child, and when this occured, the error IPointerClickHandler was showed. I changed somethings and I used a validation '!= null' to avoid this. Now is working.

avatar image BBoldenow · Sep 03, 2014 at 12:58 PM 0
Share

Unfortunately I still have no idea what was causing my issue. It seems to have resolved itself after rebuilding the scene from scratch. Luckily I didn't have much do rebuild.

avatar image Kaz_Yamof · Sep 03, 2014 at 02:19 PM 0
Share

@BBoldenow I still think that's a Unity 4.6 bug, because I changed nothing on my scene and started to get this issue on all my buttons. When added a new button, it worked fine. There are an issue tracker reported here: http://issuetracker.unity3d.com/issues/when-a-null-reference-occurs-on-the-button-on-click-the-thrown-exception-does-not-point-to-the-line-that-caused-the-error

avatar image
0

Answer by purpleshirt · Sep 16, 2014 at 05:12 AM

I also got this error.

In my case I was able to use some debug calls to find out the cause. I had made a reference to an out of bounds array reference somewhere in my own code. It wasn't in the original method that the button called, but in another method called in the subsequent scripting. I only bring this up to illustrate that the error is was not immediately local to the point where the button "jumped in" so to speak.

It was a bit of a challenge because, unlike non-button related errors, the error that pops up (with the red exclamation point) doesn't reference a line number for the error. It initially made me think the button was running some kind of script that I didn't write which was throwing up an error I didn't recognize.

I suspect that this error may be thrown up any time an error occurs before the (any?) method(s) called by the button run to completion. This makes it very challenging to quickly see where the error is!

Alas, it seems it was all my fault!

I hope this helps you or anyone else who has this error turn up on them. Good luck!

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

26 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

Related Questions

How to access SourceImage component of a button in new GUI 4.6 1 Answer

On Click paramaters disappear from button prefab? 5 Answers

(unity 4.6) GUI stuttering during animations 1 Answer

(4.6 UI) How to set up a window with x buttons, with a scroll bar? 1 Answer

uGUI: Button that overlaps text 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