# Unity navmeshagent and doors

I'm trying to make an agent patrol around a maze. The maze is proceduraly generated and consists of many rooms connected with doors. The problem occurs when the agent reaches a door. I wrote a script where if the agent gets near a door, the door opens, but the results are bad because the doors are walkable, so the navmesh doesn't consider them as obstacles and the agent gets stuck if the door opens and gets in its way.

I've been looking everywhere on the internet, but haven't found a solution. If anyone has an idea or a way to make this work, I'll be very thankful.

• Why are the doors walkable? – TomTsagk Sep 20 '18 at 14:00

• This seems to be the correct answer, however for future readers I think it would improve if in addition to providing links, you could also describe why NavMeshObstacle is the right answer, and maybe a small example of how can someone use it. – TomTsagk Sep 20 '18 at 14:02