I have a very simple piece of code,
I have a string that i wan’t only to appear if the player is in the trigger radius But it seems to always appear no matter if in the trigger or not…Code is not mine it was given to me by a generous community member.
var displayText : boolean = false;
var textString : String = "Test";
function OnTriggerEnter(hit : Collider)
{
displayText = true;
}
function OnTriggerExit(hit : Collider)
{
displayText = false;
}
function OnGUI()
{
if (displayString) {
GUI.Label(Rect(Screen.width * .4, Screen.height * .4, Screen.width * .2, Screen.height * .2), textString);
}
}
var colliding: boolean;
function OnCollisionEnter(col: Collision) {
colliding = true;
}
function OnCollisionExit(col: Collision) {
colliding = false;
}
function OnGUI() {
if (colliding) {
GUI.DrawTexture(...);
// etc...
}
}
copypasta
USE THE UNITY SEARCH! IT WAS MADE FOR A REASON!
Other than changing the name of the boolean state variable, how is that code any different from the OP’s? What is it he’s supposed to be searching for?
@rengen179, I suspect you have something besides your player tripping the trigger. Do you have any other game objects in the vicinity of your trigger?
He also uses OnCollisionEnter instead of Trigger 
In my case, I am waiting for more infos before having an idea. 