using System;
class ExampleClass
{
static void Main(){
if (GUI.Button(Rect(210,150,0,16)) == true)
{
Application.LoadLevel(Barracks);
return;
}
}
}
I dont quite know how to use the Rect() function, I am a fresh beginner in C#…
Barracks is a Scene I have set up…
This was all supposed to click on my 2D figure with scale (210,150,1) and position (0,16,154)
I’d appreciate any possible help. Thanks.
2 Answers
2
you are not including:
using UnityEngine;
Also, GUI calls need to in the OnGUI() function and you most like want to derive your class from monobehavior, which C# does not do automatically. Take a look here for more info:
http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.html
something is wrong over there, first you can see unity docs in the section of scripting.
the GUI.Button is a boolean, you don’t need apply the equals operator and the other mistake is that you are creating bad the rect, the correct sentence be the next:
if (GUI.Button(new Rect(210,150,0,16)), "Change level")
{
Application.LoadLevel(Barracks);
return;
}
oh wow, thanks man, I'll try to pay attention to what I import more...
– gigica04