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.
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:
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.
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.
answered May 11 '12 at 05:06 PM