How can I check if an object can see another object?

I am relatively new to scripting and I wanted to figure this out for myself but I am stuck. I am aware of
ray-casting, but the problem with this is, as far as I am aware, it is a line infinitesimally thin. Therefore, if a small object happened to come between and block the ray-cast, it wouldn’t work. For context, I want to check if the player character is visible to an enemy NPC in my 3D game realistically, so the player would have to be completely covered to be invisible from the NPC. The only solution I can think of is doing lots and lots of ray-casting at once but that seems really inefficient and I’m sure there is some sort of function or alternative solution? Thanks in advance!

Similar to physics raycast there is a BoxCast instead of a thin line you can use a Box

Don’t bother with ray casting at all or any physics what so ever. You check the distance between the objects. And then you check the angle.

Sorta like this:

Vector2 direction = m_Enemy00Movement.m_TargetObject.transform.position -this.gameObject.transform.position;
float angle = Vector2.Angle(direction, transform.up * -1);
float targetDistance = Vector2.Distance(m_Enemy00Movement.m_TargetObject.transform.position, this.gameObject.transform.position);
if(targetDistance < 30f)
	if (angle < m_Attack1FieldofViewAngle * 0.5f && targetDistance < m_Attack1FieldofViewRadius)
		m_Attack1TargetInRange = true;
		m_Attack1TargetInRange = false;