Here you go.....Only a basic function...but it should help
includes basic patrolling enemy ..that will search /hunt the player when door is unlocked
arrow keys to control player and E to open RED door when standing next to it...
https://www.dropbox.com/s/1p1sa9xbjpnzapb/PATHFINDING%20THROUGH%20DOOR%20EXAMPLE.capx?dl=0
Also...The main reason why a pathfinding object may struggle to pathfind through an opening is due to its Cell size.
If the cell size is too large..
Some of the gaps between obstacles will have been closed off due to the cell size being relatively large compared to the size of the gap. BAsically what I mean is that the cells borders overlap creating the appearance of a solid obstacle.. This will make the pathfinding behavior find paths entirely around the obstacles, and never through them. You can help fix this by reducing the cell size but doing so often massively increases the computation time...Best method is to play around with cell size and Cell Border...Generally they should be the same...but often you can solve problems by altering these values in relation to each other..
Also ..its worthwhile to note that placement of obstacles can either streamline pathfinding or inhibit it.
Taking more care when designing your levels by making sure that gaps are large enough or as less complicated as possible will really speed up pathfinding computation time..
And never perform 'pathfinding' calls or 'Regenerate obstacle map' Calls Every tick....it will slow down your processing drastically.
For a better explanation...see here https://www.scirra.com/manual/154/pathfinding