Dear commUnity,
I currently am working on ingame text boxes which should appear when the player enters a trigger and which disappear again when leaving the trigger. However, this is not working properly. When moving the player inside the trigger, the text box only pops up for a frame. I noticed the text box only stays active at the very edge of that trigger.
The player moves with a Character Controller and has no ridigbody attached.
This is the code:
var textBox : GameObject; // The linked text box which appears when entering the trigger
function OnTriggerEnter(other: Collider)
{
if (other.gameObject.tag == "Player")
{
// Activate text box
textBox.gameObject.SetActive(true);
}
}
function OnTriggerExit(other: Collider)
{
if (other.gameObject.tag == "Player")
{
// Deactivate text box
textBox.gameObject.SetActive(false);
}
}
I tried using OnTriggerStay as an alternative (of course, this is the first option which comes into mind) but the issue was still there. No effect on the problem.
I can also provide an image of the only position where the text box is active constantly:
(The black cube is the player dummy)