Hey everyone, just got started with unity the last few weeks because of my bachelor degree. Currently making a game and I want to add a guitext, to the script so that when my player hits the collider, it will freeze the game and text will appear saying “you win” for 5 seconds then go back to my main menu. The player is already hitting the collider and the timer is stopping but the player is still able to move. Thank you for anyhelp, need ASAP, finished game due tomorrow ![]()
using UnityEngine;
using System.Collections;
public class endRace : MonoBehaviour {
private startRace race;
// Use this for initialization
void Start () {
race = FindObjectOfType(typeof(startRace)) as startRace;
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter(Collider raceTrig)
{
//Stops timer and ends race
if(raceTrig.gameObject.tag == “Player”)
{
race.raceStarted = false;
}
}
}