Input Action

[SerializeField]
private InputActionReference interactAction;

Detectar

void Update()
{
    if (interactAction.action.WasPressedThisFrame())
    {
        Interactuar();
    }
}

Con Raycast

if (Physics.Raycast(
    origen,
    direccion,
    out RaycastHit hit,
    distancia))
{
    if (hit.collider.TryGetComponent<IInteractable>(
        out IInteractable interactuable))
    {
        interactuable.Interact();
    }
}

Resumen rápido

WasPressedThisFrame()
TryGetComponent<IInteractable>()