It is necessary to make so that contents in the room will be visible only if the character is in this room. If a player is not in the room that the game camera can see, then that room is closed by a black rectangle, which has the shape of the room that it covers.
PS I create 2d platformer on Unity using c #.