I need help with some AI issues for a cemi-3D game I'm working on.

Okay so, I want to make an AI for an enemy that will chase the player, but only if he is not behind an object. So it seems he only chases you if you can be seen by him. I already know how to make him follow the player, I just need to figure out how to measure if the player is behind an object or not. If you can please try and make some kind of demo. If you can’t I’m okay with someone just telling me what to do. Thanks.

(Note: this is for a Cemi-3D game like Undertale or Pokemon.)

Use a Raycast set to the player and use a Raycast set to any object.
Make the Raycast for any object turn a switch off that the other Raycast for the player will go into.
The Raycast that detects the player will not output from the switch.

Thanks! this really helps!