How can my NPCs open doors?

Hm, i just think about saving the doors somewhere.
The Navigation mesh could be used for the movement inside a room.
You just need to have a way to save the rooms and the doors, so that
the NPC knows where he is.

It’s like a list that the NPC needs to go through.

Room 1 is the savepoint. He is in Room 5. So he has a list of Rooms
and doors. He knows that Room 5 has 2 doors, one to Room 3 and one
to Room 4. Room 3 has a door to Room 2 and this one a door to Room 1.

So now you need to think of a way to go through this list and give the
NPC the order to move to the Door. Opening it is the easy thing. Just make
a Collision Box or something that fires on colliding with the NPC and opens the door.
You can call a delay if the NPC leaves the door collider. This can close the door automaticaly.

The List would be an array of a struct. That struct has the RoomName and a second array of
door names/positions. If the NPC is in a room, you can have a collider here as well that
detects the NPC or maybe that the NPC detects the room and sets the current room
to the one hes in. So than he knows where he is and what doors are in the room.

It’s a bit complicated and i don’t know if there is an easier, more dynamical way.