googlevr / cardboard

Open source Cardboard SDK and samples
Other
1.49k stars 255 forks source link

iOS 14.7-15 Google Cardboard view is broken #299

Closed MusemoDeveloper closed 3 years ago

MusemoDeveloper commented 3 years ago

SPECIFIC ISSUE ENCOUNTERED

Hello, found an issue with VR view. Vr screens are small, so it is impossible to use app.

SMARTPHONE

STEPS TO REPRODUCE THE ISSUE

  1. Empty Unity project
  2. Set settings according docs : https://developers.google.com/cardboard/develop/unity/quickstart
  3. Build and run app on iphone

EXPECTED BEHAVIOR

View should be adopted to device screen resolution

VERSIONS USED

Cardboard XR Plugin : 1.8 Unity : 2020.319f1 LTS

SCREENSHOTS

Here are screeshots of hw it is looking, and other settings ### On device

Screenshot 2021-09-26 at 12 57 08 Screenshot 2021-09-26 at 12 57 21 Screenshot 2021-09-26 at 12 57 37
johnfriedrich commented 3 years ago

Each new iPhone needs a hardcoded DPI value. Thats why its broken. New DPI values: https://useyourloaf.com/blog/iphone-13-screen-sizes/ See this issue if you need that hotfixed asap https://github.com/googlevr/cardboard/issues/144

jballoffet commented 3 years ago

Thanks @MusemoDeveloper for reporting this issue. As @johnfriedrich pointed out, new DPI values are required so as to support the new iPhones. A fix for this has been already submitted and it will be included in the next release. In case you cannot wait until v1.9.0 is out, you can apply the required changes by yourself. In order to do so, you just need to add the correct DPIs for 2021 iPhone models in this file, by applying the following patch:

diff --git a/sdk/screen_params/ios/screen_params.mm b/sdk/screen_params/ios/screen_params.mm
index 1ecfe80..2984b6c 100644
--- a/sdk/screen_params/ios/screen_params.mm
+++ b/sdk/screen_params/ios/screen_params.mm
@@ -51,6 +51,10 @@ NSString *const kGIPDeviceGenerationiPhone12Mini = @"iPhone 12 Mini";
 NSString *const kGIPDeviceGenerationiPhone12 = @"iPhone 12";
 NSString *const kGIPDeviceGenerationiPhone12Pro = @"iPhone 12 Pro";
 NSString *const kGIPDeviceGenerationiPhone12ProMax = @"iPhone 12 Pro Max";
+NSString *const kGIPDeviceGenerationiPhone13Mini = @"iPhone 13 Mini";
+NSString *const kGIPDeviceGenerationiPhone13 = @"iPhone 13";
+NSString *const kGIPDeviceGenerationiPhone13Pro = @"iPhone 13 Pro";
+NSString *const kGIPDeviceGenerationiPhone13ProMax = @"iPhone 13 Pro Max";

 // iPod touch Generations.
 NSString *const kGIPDeviceGenerationiPodTouch7thGen = @"iPod touch (7th generation)";
@@ -116,6 +120,10 @@ CGFloat getDpi() {
     @"iPhone13,2" : kGIPDeviceGenerationiPhone12,
     @"iPhone13,3" : kGIPDeviceGenerationiPhone12Pro,
     @"iPhone13,4" : kGIPDeviceGenerationiPhone12ProMax,
+    @"iPhone14,4" : kGIPDeviceGenerationiPhone13Mini,
+    @"iPhone14,5" : kGIPDeviceGenerationiPhone13,
+    @"iPhone14,2" : kGIPDeviceGenerationiPhone13Pro,
+    @"iPhone14,3" : kGIPDeviceGenerationiPhone13ProMax,
     @"iPod9,1" : kGIPDeviceGenerationiPodTouch7thGen,
   };
   NSString *model = models[modelName];
@@ -153,6 +161,10 @@ CGFloat getDpi() {
     kGIPDeviceGenerationiPhone12 : @(kIPhone12Dpi),
     kGIPDeviceGenerationiPhone12Pro : @(kIPhone12Dpi),
     kGIPDeviceGenerationiPhone12ProMax : @(kIPhoneOledDpi),
+    kGIPDeviceGenerationiPhone13Mini : @(kIPhone12MiniDpi),
+    kGIPDeviceGenerationiPhone13 : @(kIPhone12Dpi),
+    kGIPDeviceGenerationiPhone13Pro : @(kIPhone12Dpi),
+    kGIPDeviceGenerationiPhone13ProMax : @(kIPhoneOledDpi),
     kGIPDeviceGenerationiPodTouch7thGen : @(kDefaultDpi),
   };
xinyunh0929 commented 3 years ago

Fixed in 1.9.