Hey guys,
I’m currently working on a game and I’m working on implementing a scoring system in my game and it’s not appearing properly. I’ve attached a picture to show what’s happening and where the score is showing up and where I would like the score to actually be. The score is appearing on the far left of the screen and I would like it to be contained inside the black box on the playing field. My code is as follows:
private var playerScore : int;
var scoreStyle : GUIStyle;
function Start () {
renderer.material.color = Color.black;
}
function Update () {
}
function OnGUI() {
GUILayout.BeginArea(Rect(10,10, Screen.width/2, Screen.height/2));
GUILayout.Box(playerScore.ToString(), scoreStyle);
GUILayout.EndArea();
}
function Score() {
playerScore = 0000;
}
function OnTriggerEnter(collision:Collider) {
if (collision.gameObject.tag == "Zs")
{
playerScore += 10;
}
}
Thank you all in advance for your help on this subject and I hope the community can be of assistance. Much appreciated again.
- Slyy