how can I make the resolution adjust to current window's size

I am trying to make a puzzle game and the size of the levels are constant. When I change from fullscreen to window mode, part of the level can’t be seen. How can I make it so it readjust itself according to the size of the actual window of the game?

solution 1

adjust level size to camera’s height. you can be sure your camera height is constant, independent of screen height

solution 2

with some time interval check values Screen.height and Screen.width and update your project on changing