How to avoid that the notch on the iPhone covers up part of my 2D game?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By McJumpy

I build a landscape 2d game. The notch of the iPhones covers up a part of the game on the right or left. This part is important to the game. Therefore I don’t want the notch to cut into the game. Instead the notch part of the phone should be completely black. Can anyone help my with this?

:bust_in_silhouette: Reply From: Wakatta

Change
Project Settings > Rendering > Environment > Default Clear Color to Black
Project Settings > Display > Window > Handheld > Orientation to SensorLandscape

In order to view your project
Add
a ViewportContainer node as your scene root
a Viewport node as a child of ViewportContainer
all your main game scene contents as a child/children of Viewport

Change Viewport’s rect_position.x to the edge of the notch (you may have to do some Goldilocks work)

Minus Viewport’s rect_position.x from Viewport’s rect_size.x

P.S. All of the above can be achieved in code using the root viewport and encapsulating it with an if OS.get_name() == "IOS": or
if OS.get_model_name() in [list of notch carring phone models]