How to make a NPC see/hear

How do you make a NPC that gathers info on what it sees
Like the NPC could only see in front of him (unless he turns his head)
And if the NPC can see a object (which is not block by another object)
Then get the disired info…

Also how do you have the NPC hear sounds
Like if a bomb blows up far away the NPC reacts (looks up)

Thanks

Physics.RayCast is probably the best way to determine if an NPC can see something. Specify a view distance.

Alternative is to attach a camera to NPC, but I feel this would be overkill…

I would use Physics.OverlapSphere from the point of sound. Any gameobject within radius hears explosion

Ok thanks I will try it

Ok I finished the seeing part

Now to the hearing part how would you do your idea
Would you make a script for each object that makes a sound and when it makes a sound makes a Physics.OverlapSphere and if a object that listens to sound hears it it would act according
Thanks

Yeah that about sums up how I would do it.

Ok Thanks will try it and get back to you