how do i detect if a game object is visible to another game object

I big dumb and dont know how unity work so i am just trying to make a game object move towards another game object.
Im trying to make it so it doesnt move towards the other game object when the other game object is hiding behind something.
Im also trying to create an area that the original game object can see in, so it can see things behind it as well.
How do thing?

Watch out this