I am trying to get an end menu for a racing game, below is the code we are using for a lap timer as well as the GUI text. I don’t need any help on the lap counter, what i do need help with is finding the most efficient way to show and hide my GUI text. I want 2 GUI texts hidden at the start of the scene then after 3 laps when the game freezes it will show the 2 GUI texts.
static var midcheck = false;
static var counter : int = 0;
var speed : float = 4;
var carfor : GameObject;
var target : Transform;
var maincam : Camera;
var yourGUItext : GUIText;
function OnTriggerExit (other:Collider) {
checklaps();
HideGUIText();
lol();
ShowGUIText();
}
function checklaps (){
if ( checkpoint.checkpointcheck == false){
Debug.Log("FALSE");
}
if ( checkpoint.checkpointcheck == true){
++ counter;
checkpoint.checkpointcheck = false;
}
}
function HideGUIText()
{
yourGUItext.enabled = false;
}
function lol () {
if ( counter >=3) {
carfor.GetComponent("Car").enabled = false;
Time.timeScale = 0;
Screen.showCursor = true;
function ShowGUIText()
{
if ( counter >=3) {
yourGUItext.enabled = true;
}