error with unity button unityengine.rect does t contain 5 contru

so in my code i am getting an error when making this button:

for(int y=0; y<hostData.Length;y++) {
				if(GUI.Button(new Rect(Screen.width / 2, 65f + 30f * y, 30f, 300f, hostData[y].gameName))) {
				

				}

please help

The button you create needs a rectangle to tell it where on the screen you want it, and the width and height of the button. So, that’s 4 pieces of data (x, y, width, height). However, in your code you are giving the rectangle a fifth parameter, hostData[y].gameName which is not needed. So, the compiler is telling you that this 5th value indicates you have made a mistake.

To fix your mistake, simply move one of your closing brackets after the 300f.

*sigh*

if(GUI.Button(new Rect(Screen.width / 2, 65f + 30f * y, 30f, 300f), hostData[y].gameName)) {
                                                                /|\                     /|\
                                                                 |                       |
                                                              Add bracket          remove 1 bracket