- Home /
Javascript GUI.Button help, Error BCE0077
Hello, I am trying to make a button that takes the player from the main menu to the game. I am getting this error: Assets/titleScript.js(7,29): BCE0077: It is not possible to invoke an expression of type 'int'. And here is my code:
var btnTexture: Texture;
function onGui()
{
if(GUI.Button(Rect(10,10,50,0(Screen.width -50,50,0,0),btnTexture)));
Application.LoadLevel("game");
}
function Update () {
}
Any help would be greatly appreciated!
Answer by KiraSensei · Dec 08, 2014 at 04:25 PM
Hi !
Several things :
The function should be OnGUI, not onGui.
Then your error is in : GUI.Button(Rect(10,10,50,0(Screen.width -50,50,0,0),btnTexture))
Rect takes only 4 arguments, you have something weird going on 4th argument. I don't really know what you really wanted, maybe
if(GUI.Button(Rect(10,10,50,Screen.width-50),btnTexture));
Your answer
Follow this Question
Related Questions
How can I attach a GUI.Button to a variable? 2 Answers
Linking button press with questions 3 Answers
DrawTexture GUI iPhone 1 Answer
When I restart the level, everything doesn't move 2 Answers
Setting Scroll View Width GUILayout 1 Answer