Hey, I’m making a game where I need a gameobject to react when E (Or any button) is pressed within the area of a trigger collider. I don’t know if there is any specific command far “While inside trigger”, and if there is one, I have yet to find it. I’d appreciate anyone’s help, thank you.
use a bool to know when someone is in a trigger.
for example.
void OnTriggerEnter (collider object)
{
if (object.tag == "player")
DoReact = true;
}
void OnTriggerExit (collider object)
{
if (object.tag == "player")
DoReact = false;
}
if (input.keycode('e') && DoReact)
{
...do something
}