Hi! I’ve been trying to create a simple FPS shooter type game.I am trying to create a timer that counts down and if you survive the amount of time it will display a 2D texture I have created. But, for some reason I just cannot figure out what is wrong with my Javascript even after a lot of time searching the internet. I’ll Copy the script I have below. I would really appreciate any help on how to fix it to display the desired texture. Thanks in advance!
#pragma strict
var myTimer : float = 300.0;
public var finishTexture : Texture2D;
function Start () {
}
function Update () {
if(myTimer > 0){
myTimer -= Time.deltaTime;
}
if(myTimer <= 0){
Debug.Log(“GAME OVER”);
}
function OnGui ()
{
if (myTimer <= 0) {
GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), finishTexture);
}
}
}