- Home /
Simple OnGui does not work
I tried everything to get this working but somehow I can't...
using UnityEngine; using System.Collections;
public class GameManager : MonoBehaviour {
public static int playerScore01 = 0;
public static int playerScore02 = 0;
public static void Score (string wallName) {
if(wallName == "_rightWall")
{
playerScore01 += 1;
}
else
{
playerScore02 += 1;
}
Debug.Log ("Player Score 01 is" + playerScore01);
Debug.Log ("Player Score 02 is" + playerScore02);
}
void OnGui() {
GUI.Label (new Rect (Screen.width / 2 - 150, 20, 100, 100), "bla");
GUI.Label (new Rect (Screen.width / 2 + 150, 20, 100, 100), "bla");
}
}
I think the code is fine, but somehow I can't see the GUI when testing the game... is there a problem in the code I am to dumb to see?
Please help...
Comment
Best Answer
Answer by YoungDeveloper · Jan 19, 2014 at 07:15 PM
It should be OnGUI() not OnGui()
http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.OnGUI.html
WOW... How did I not see this :D
Thank you very much
I spent so much time on this -.-
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Problems with instantiation... 1 Answer
C sharp menu problem with bottons 1 Answer
Multiple Cars not working 1 Answer
GUI Problem 2 Answers