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 hmortensen2907 · Jan 19, 2015 at 10:38 PM · buttonnullreferenceexceptiononclick

OnClick, parameter setup in editor becomes null??

Hi all,

I have the following setup, and I simply can't figure out what i'm doing wrong?

When I click the Settings button and trigger the on Click on Menu - Canvas which calls the ShowMenu on the MenuManager, I get a null exception????

Hope someone can see what's wrong with the setup..

Have a nice evening :)

  • Henning

alt text

gui.png (58.5 kB)
Comment
Add comment · Show 1
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 hmortensen2907 · Jan 20, 2015 at 09:10 PM 0
Share

Changing the Show$$anonymous$$enu $$anonymous$$ethod to take a gameobject as parameter and doing a get Component works. But that's just wrong and shouldn't be necessary, I've see it done in in https://www.youtube.com/watch?v=QxRAIjXdfFU

http://git.ashwanik.in/mainmenusystem/

I've compared my methods to they match. So I figure that it's the setup in the editor? Just can't see it.

[1]: /storage/temp/39206-menuwork.png

menuwork.png (5.5 kB)

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by hmortensen2907 · Jan 20, 2015 at 09:42 PM

Hi all,

Ok, so the problem is in the editor! I downloaded the project for https://www.youtube.com/watch?v=QxRAIjXdfFU, as mentioned in the comment, and tested it, and it works... Well that's until I drag the SAME object to the OnClick event as already set. Then it changes from script to GameObject. So it's not me that's nuts ;)

I'll download Patch 4.6.1p4 and see if that solves anything, else I'll make a bug report.

Have a great day everybody. Now, go make games! ;)

  • Henning

Comment
Add comment · Show 1 · 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 hmortensen2907 · Jan 20, 2015 at 10:23 PM 0
Share

Just Found this...

http://issuetracker.unity3d.com/issues/button-null-references-when-passing-gameobjects-as-parameters-to-functions-called-by-the-onclick-events

Guess I'll have to wait for 4.6.2 :/

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

25 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

Related Questions

Method added on a button click with a delegate is being called twice. 0 Answers

Having issues determining a way to use buttons in a script. 2 Answers

Enabling/Disabling a slider from script 0 Answers

How do change UI.button onclick states(off, editor and runtime, runtime only) via script? 0 Answers

How do I make a function not appear on UnityEvents / Button OnClick lists? 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