So I’m trying to make a basic dialogue system using on-trigger-enter and i want my character to enter the trigger area and press “f” however when i go in the trigger and press “f” I’m not getting the console message for but i am for when i enter the trigger. After some research it said that the input.getkeydown has to be in the update function but the problem is that even when I’m not in the trigger i can still press f and the console message will appear. How do I make it i can only press f in the trigger
function Update ()
{
if (Input.GetKeyDown("f"))
{
Debug.Log("f is pressed");
}
}
function OnTriggerEnter (other : Collider)
{
if(other.tag == "Player")
{
Debug.Log("Press F to Talk");
}
}