using UnityEngine;
using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
void Start () {
}
void OnGUI(){
GUI.Label (Rect (10, 10, 100, 20), “Hello World!”);
}
}
(C#) why was wrong?
What can I do about it?thrank you!
using UnityEngine;
using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
void Start () {
}
void OnGUI(){
GUI.Label (Rect (10, 10, 100, 20), “Hello World!”);
}
}
(C#) why was wrong?
What can I do about it?thrank you!
I think you must change the classname from NewBehaviourScript to something else (like HelloWorldScript) and before that you also need to change the name of the scriptfile to the same.
And
GUI.Label (Rect (10, 10, 100, 20), “Hello World!”);
should be
GUI.Label (new Rect (10, 10, 100, 20), “Hello World!”);
?
this ![]()
Yes boxer’s reply is right. You need a new rect.
As for renaming, no you don’t need to rename the script or class as long as they both have the same name.
Why is your OnGUI() method inside of the start method? Start is only called when the game start up. I always put OnGUI() as its own method, outside of everything else.
He doesn’t have it inside the Start() method.
Haha someone blind