x


Gui.SelectionGrid, too few buttons?

    var levelGridInt : int = 0;
var levelGridStrings : String[] = ["Cubic Flatts", "Blank Test", "Blank Test 2", "Blank Test 3"];

On Gui...

levelGridInt = GUI.SelectionGrid (Rect (Screen.width *.33 +3, 20, Screen.width *.2 -5, Screen.height *.1), levelGridInt, levelGridStrings, 1);

The problem is, I never see "Blank test 3". I've only seen one other similar problem to this, and his solution didn't work out for me. I have to assume it's human error in the code, some where, but I don't know where I went wrong.

more ▼

asked Oct 21 '10 at 07:18 AM

FreeTimeDev gravatar image

FreeTimeDev
408 14 20 30

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

The code you posted works for me without modification, using the default skin, running in the Game View in the Unity 3.0 editor.

It appears some external factor is contributing to your problem (version of Unity, GUI skin, screen size, platform, or surrounding code that you did not include in your question.)

more ▼

answered Oct 21 '10 at 12:38 PM

Bampf gravatar image

Bampf
5.1k 8 20 49

Okay, this must be a bug with unity, in some manner.

I opened up Unity to take a look at the code to see if it "magically works". It didnt. Same error. But, then I commented it out to look at the box that's behind it etc, then uncommented it. Still the same problem. Then, I changed it to two columns, and it worked. Back to one column, still working.

Very weird. I didn't change anything else, at all.

At the very least, thanks for getting me to look at it again.

Oct 23 '10 at 05:34 AM FreeTimeDev

That is strange. The only thing I can think of is if the string array was a public variable of your component, exposed in the Inspector. In the Inspector you might have accidentally reduced the length by one. That change would "stick"- the array initialization in code wouldn't apply until you made other changes such as changing the name of the array or declared it private.

Oct 24 '10 at 02:25 PM Bampf
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3811
x38

asked: Oct 21 '10 at 07:18 AM

Seen: 1034 times

Last Updated: Oct 21 '10 at 07:18 AM