Detecting safe area for GUI (i.e., avoid notch)

Is there any mechanism for this? To be clear, I’m not talking about https://github.com/defold/extension-safearea, as it seems that just scales all rendered content, leaving bars at the top and bottom. The ideal solution would allow for detecting the safe area and incorporating it as seamlessly as possible - i.e., the world space view would generally fill the entire screen, but HUD would be top aligned under the notch, and would also leave space at the bottom. Full screen UI menus would have a background that fills the entire screen, while the contents would follow the same scheme as the HUD above…

At this point, there are many devices with notches (across iOS and Android), so it’s less than ideal to try to do device-by-device special casing. Wasn’t able to find anything covering this topic. Thanks.

2 Likes

+1 on this.

Even just detecting if there’s a notch for now would be great.

1 Like

I think we would need a new extension to detect the notch and possibly also return the dimensions of the safearea/area outside of the notch. It shouldn’t be too hard to create.

6 Likes

Sorry to bump this topic but I’m working on a manual about porting Defold games to new platforms and wanted to add a section about designing for hole-punch and notch cameras and came across this old post. The safe area extension has been improved since this topic was created and now has support for getting the insets/unsafe area of the screen:

7 Likes

That’s really neat! Thanks