Navemeshagent and doors

I’m trying to make an agent that patrols around a maze (the maze is proceduraly generated, it’s many rooms connected with doors) the problem is when the agent reaches a door, i wrote a script where if the agent gets near a door the door opens but that doesnt give goood results because the doors are walkable so the navmesh doesnt consider them an obstacle wish makes the agent stuck if the door opens and gets in it’s way. I’ve been looking everywhere on the internet but no one solutions found. If anyone has an idea or a way to make this work i’ll be very thankful.

Use NavMeshObstacle on doors: Unity - Manual: Nav Mesh Obstacle

Disable carving for doors. When the door is opened, disable obstacle and enemy will continue.

This is considering Enemy AI has no other possible option to continue the the goal.