Foldable devices have a cover screen and a main screen that have different aspect ratios. The outer screen has an aspect ratio of 23.1:9 and the inner screen has an aspect ratio of 19:3. This means that extra considerations are needed to achieve the best user experience on either screen. Outside of foldable comparability, we recommend that you consider how the Field of View (FoV) is scaled.
Default field of view solution in Unity
Unity uses a vertical FoV (Hor+) for its cameras. The horizontal FoV option appears to convert into vertical FoV when switching between the main screen and cover screen.
This can result in an issue when playing games in landscape mode on foldable devices. When switching screens, the FoV appears to change, resulting in the scene appearing larger or smaller and parts of the screen being hidden or revealed. For an example, see the images below:
Figure 1: Cover Screen, Vertical FoV (Hor+)
Figure 2: Main Screen, Vertical FoV (Hor+)
The above example uses vertical FoV (Hor+). The cover screen is using the intended FoV when launching the app. When switching to the main screen, notice the "zoom" effect, where the cube is much bigger and the sides of the plane are cropped.
Recommended Field of View solution
Figure 3: Cover Screen, Horizontal FoV (Vert-)
Figure 4: Main Screen, Horizontal FoV (Vert-)
In games where you need to see wide FoV like FPS or racing games, this could potentially give players a disadvantage. The above example uses horizontal FoV (Vert-). Notice how both cubes and planes appear much closer in size, compared to the vertical FoV example. Whilst we lose a small amount of vertical space, this is much less than when using vertical FoV.
Implementation
In order to achieve the above effect, we recommend using horizontal FoV (Vert-) in Unity. This can be achieved via C# by using Camera.HorizontalToVerticalFieldOfView(Angle, AspectRatio). For example:
NoteThis still results in the vertical FoV changing between displays, so there is the possibility of some of the view being cropped by the FoV change.
The FoV needs to be updated every time the device switches display to ensure a consistent horizontal FoV. Unity uses a vertical FoV so we need to recalculate what the correct vertical FoV should be to maintain our horizontal FoV.
To detect when the device switches displays, we recommend using the WindowManager API, which is part of the Android Jetpack library. A Java Callback Adapter can be set up to call a native function, where the FoV can then be updated.
As this process is too complicated for a short guide, below are links to documentation on how to set up a Java Callback Adapter for the WindowManager API. There is a Samsung blog post and Codelab which work together to explain how to implement the WindowManager API for use in Unity.
NoteThis Code Lab focuses on using WindowManager to implement Flex Mode. However, the implementation of WindowManager can also be used to detect when the device switches display.
Summary
We recommend that developers test their games on foldables and decide which axis to scale the FoV so the changes are less noticeable between the cover screen and main screen.
Manage Your Cookies
We use cookies to improve your experience on our website and to show you relevant
advertising. Manage you settings for our cookies below.
Essential Cookies
These cookies are essential as they enable you to move around the website. This
category cannot be disabled.
Company
Domain
Samsung Electronics
.samsungdeveloperconference.com
Analytical/Performance Cookies
These cookies collect information about how you use our website. for example which
pages you visit most often. All information these cookies collect is used to improve
how the website works.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Functionality Cookies
These cookies allow our website to remember choices you make (such as your user name, language or the region your are in) and
tailor the website to provide enhanced features and content for you.
Company
Domain
LinkedIn
.ads.linkedin.com, .linkedin.com
Advertising Cookies
These cookies gather information about your browser habits. They remember that
you've visited our website and share this information with other organizations such
as advertisers.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Preferences Submitted
You have successfully updated your cookie preferences.