I have a player that can move and has a collider and a rigidbody.
I have an interactable object that has a trigger collider and a rigibody too.
The object has this script attached:
public class Interactable : MonoBehaviour
{
private void OnTriggerStay(Collider col)
{
Debug.Log("Inside the range");
if (Input.GetKeyDown(KeyCode.E))
{
Debug.Log("Interacted with an object");
col.gameObject.GetComponent<StateManager>().Interact();
}
}
}
Why isn’t the function called when player walks inside the trigger that has that script?