Hello everyone, I have a question for you all today. I have been trying to display some text telling a player to turn back or be killed so that they don’t fall off the map, but I am having some trouble actually displaying it on the screen. My code so far is as follows:
using UnityEngine;
using System.Collections;
public class Boundaries : MonoBehaviour
{
//Declaring variables
bool crossedBoundary;
void OnTriggerEnter(Collider other)
{
//Telling game to actiavte boolean
if(other.gameObject.tag == "Player")
{
crossedBoundary = true;
}
}
void OnGUI ()
{
//If the boolean is active, display the text
if (crossedBoundary == true)
{
GUI.Label(Rect(200, 100, 0, 0), "Turn back or die!");
}
}
}