I need to fix my enemy's Xray vision.[solved]

I’m not sure if this is the right place to post this, but here it goes.
At the moment, the AI for my enemy in the game is based on the enemy’s direction and his distance from the player, however, if there is a wall between me and the enemy, he can see right through it and will begin to advance towards me. How can I make it so that the walls obstruct his vision?

You most likely want to do raycasting, which is you cast a ray (duh :P) from the enemy to the player, and check for any object that intersects with the line.

Thanks, that should work… If I knew how to do that. I’m still pretty new to coding.

WAIT nevermind. I’ve got it now.