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 Kraton · May 11, 2012 at 04:07 PM · guierrortoolbararguments

(SOLVED) "No appropriate version of 'UnityEngine.GUI.Toolbar' for the argument list '(UnityEngine.Rect, int, UnityEngine.GUIContent, UnityEngine.GUIStyle)' was found." Help?

In a game I am making, the GUI is supposed to have a set of buttons with only one selectable at a time (activating button 1, for example, would deactivate button 0). The obvious choice for this would either be a GUI.Toolbar or a GUI.SelectionGrid. For my purposes I'm going with Toolbar. The problem I keep coming up with is that Unity seems to think that there is no version of Toolbar with the arguments Rect, Int, GUIContent, and GUIStyle. According to both MonoDevelop and unity3d./support, this should not be the case.

http://unity3d.com/support/documentation/ScriptReference/GUI.Toolbar.html

I have the most up-to-date version of Unity and I have not gone messing around with anything that I should not have. So that rules out the possibility that I've somehow f****d it up to the extent that I've screwed up UnityEngine.GUIContent.

The error I get is the title above. And the section of my code that is related to the issue is as fallows:

 if(GUI.Toolbar(Rect(alignLeft,alignBottom - toolBarHeight,
                              toolBarWidth,
                              toolBarHeight),
                      toolBarState,
                      GUIContent (grenadeSlot1, "This is the tooltip"),
                      HudSkin.FindStyle("Grenade_Buttons")))
 {
     //I don't have anything filled in here yet.
 }

Originally this was not how I had this section of code written, but it was the only way I'd found that Unity actually knew what the contents and style were (it otherwise treated them as Strings, which they are not). If anyone has a suggestion for a simpler way to write the Content and Style that actually works, I'm all ears.

However the problem I need to fix first is the error I keep getting. It makes NO sense to me what so ever. It SHOULD allow for those argument types in that order. That is what I need help with. I've looked at my code and the error for several hours, tried many little tweeks to see if I could figure out why it was giving me this error, and have gotten to the point where I've given up on solving it myself. I am hoping my failure to solve this myself won't lead to people on this site laughing and refusing to help, because I've got nowhere else to go.

If the variable names in the code above are confusing I can show the code that defines them, but I figure it's probably not necessary, as I can assure that they are of the type they are expected to be.

On a side note, once this error is fixed I could also use some help capturing the value returned from clicking any of the buttons so that I can use it to redefine which button is Active immediately after each click.

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Kraton · May 11, 2012 at 05:06 PM

I figured out what I was missing. The error was misleading (I should have expected that after all this time of programming), but the problem was that I was attempting to define the Content within the if statement. I needed to define it separately beforehand.

Problem solved.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Loading a scene in game with a GUI 1 Answer

OnMouse* functions for Toolbar elements? 0 Answers

Impossible: 2 toolbars show being clicked at the same time! 1 Answer

C# No overload for method 'BeOlvasBabok' takes 1 arguments 1 Answer

Can't draw a box using Basic GUI 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