How to check if AI path is valid (i.e. AI can reach target)?


So here is the basic problem i am currently facing: I am spawning AI enemies that should walk to a certain location. The player can however build obstacles that can make this way longer. If the player now makes it impossible for the AI to reach its target, the enemies are allowed to destroy the obstacles. How can i solve this?