Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 RothX · Jan 06, 2016 at 11:40 PM · uibuttononclick

My Function is not showing up in the OnClick Menu

Hey guys, so I am trying to create a button that runs a function in my script. I dragged the object into the OnClick, and the script shows up, but not the function I put in there, only base GameObject functions. I looked this up, and the only response is that you can only use functions that return void, are public, and only take 0 or 1 parameters, but my function satisfies all those conditions, and it still doesn't show up.

EDIT: Well, people asked to see the function. I didn't post it because I just described the whole thing...

     public void Advance()
     {
         stage++;
     }

I know there's not much to it, but I will add more, this was just to make sure that the button worked...

EDIT 2: What...The function shows up now, but I didn't change anything..and don't say it was a problem with me saving the script, as I had made sure to save he script, save the scene, and even restarted unity, with no results. And I started up Unity today...and it was there. No clue, maybe it need 24 hours to process...

Comment
Add comment · Show 3
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 saschandroid · Jan 07, 2016 at 07:09 AM 0
Share

"...take 0 or 1 parameters" and must be an int, bool, float, string or unity object.

avatar image RothX saschandroid · Jan 07, 2016 at 03:47 PM 0
Share

Well, it takes in zero parameters, so I think I'm ok on that front.

avatar image Bonfire-Boy · Jan 07, 2016 at 09:54 AM 0
Share

What do you mean when you say that "only base GameObject functions" show up? Perhaps you could show us a screenshot of the drop-down you get there. There ought to be a sub-list for GameObject as well as one for Transform, plus one for each of the components you've added to the GameObject.

Another possibility I guess is that you've mistakenly written "GameObject" ins$$anonymous$$d of "$$anonymous$$onoBehaviour"? (ie your own script does show up but the only functions in its sublist are ones it gets from $$anonymous$$onoBehaviour).

And it is kind of strange to ask this question without showing us the code for the function.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by L_Artista · Jan 07, 2016 at 07:28 AM

Make should it is public and doesn't have more than 1 parameter!

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 saschandroid · Jan 07, 2016 at 09:12 AM 0
Share

He already wrote in the question, that these conditions are satisfied.

avatar image
0

Answer by Death_Nova · Aug 12, 2018 at 01:32 AM

Not applicable to your script, but something quirky I found. My button would not accept an enum value as the argument. Using int value and (enum)value now, but the script would not show up until the argument was of a basic type.

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 Bonfire-Boy · Aug 12, 2018 at 07:47 PM 0
Share

This is as expected, see saschandroid's comment to the original question.

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

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Runtime UI button creation: can't make an "OnClick" where I call a function from another script while sending a parameter. 2 Answers

Calling preset Button OnClick events from another script 3 Answers

button.onClick.AddListener(method); NOT Working 1 Answer

Button OnClick() after Scene restart is Missing (Object) 2 Answers

Button.onClick.AddListener(() => Attack()); isn't running function math correctly 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