How can I not let the AI see and shoot through walls?

I’m working on a top down shooter with multiple rooms. As soon as the AI ​​has sight of the player, they shoot. The problem is that they also do this through walls. Do you have any ideas how to prevent the AI ​​from shooting through walls?

Hi, you could use a raycast in connection with your enemy. If the raycast hits a wall, the enemy won’t shoot.

1 Like

Great idea! Thank you