I am trying to displaying an entrance text but I want it to get displayed only once when I am entering into one of my buildings. But as I am using a box collider, it still displays the same text when I am leaving the building. Here’s the scripts that I am using. Thanks
Btw both scripts are placed on the box collider right now.
WelcomeMCScript:
var close = false;
var textFieldString = "text field";
var customSkin : GUISkin;
//var MCGUI : GUIText;
//var guiTexture: GUITexture;
var fadeSpeed : float = 2;
var isPlaying : boolean;
function SetTheGUI () {
close = true;
isPlaying = true;
}
function UnSetGUI () {
close = false;
isPlaying = true;
}
function OnGUI () {
if (close) {
GUI.skin = customSkin;
//GUITexture = guiTexture;
GUI.Label (Rect (900, 300, 100, 40), textFieldString);
//GUI.Label (Rect (25, 25, 100, 30), textFieldString);
isPlaying = false;
}
}
WelcomeMCScriptTrigger:
function OnTriggerEnter(other : Collider)
{
if (other.tag == "Player")
{
SendMessageUpwards("SetTheGUI");
}
}
function OnTriggerExit (other : Collider)
{
if (other.tag == "Player")
{
SendMessageUpwards("UnSetGUI");
}
}