Porting project in Godot 3 - broke switching resolution viewport

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DimitriyPS
:warning: Old Version Published before Godot 3 was released.

In Godot 2.1, ProjectSettings I set “Stretch Mode=viewport”. Then I called the method get_viewport().set_rect(Rect2). Worked this way the simulation of switching screen resolution. Albeit it is technically a little different.

Now I portiou project for Godot 3. In Godot 3 all broke.
Method get_viewport().set_rect(Rect2) does not exist. There is a method get_viewport().set_attach_to_screen_rect(Rect2)… but it is not working properly.

Now how to implement the simulation of switching screen resolutions?