Search Unity

Black screen on iOS device (Beta14)

Discussion in 'Unity 5 Pre-order Beta' started by ng-pixels, Nov 25, 2014.

  1. ng-pixels

    ng-pixels

    Joined:
    Dec 29, 2012
    Posts:
    68
    Hi there,
    I can see only black screen after starting the game on an iPad or iPhone.
    I also tried an empty scene. I do not see Unity logo at the beginning.
    Everything worked in Beta13.
    Thanks.
     
  2. ng-pixels

    ng-pixels

    Joined:
    Dec 29, 2012
    Posts:
    68
    Works on Android without any problem. Only on iOS there is a black screen.
     
  3. Marcellus_Wilson

    Marcellus_Wilson

    Joined:
    Jul 19, 2013
    Posts:
    12
    I hit the same problem. It worked when I changed the build settings from open GL 3.0 to Metal. It seems to run a little slower than b13 on open GL 3.0, but it looks a little better.
     
  4. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    I am now having the same problem on iOS. Setting to GL2,3, or Metal makes no difference.

    The app launches and remains on a black screen (no unity logo shown). The app is running fine as a debug in the output from the update is constantly updating.

    Anyone have any ideas or is this a beta 14 defect?

    PS. May be worth mentioning - using 6+ iPhone (8.1.1)
     
    Last edited: Nov 25, 2014
  5. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    Surely it is not just ng and myself with this problem?

    Can anyone confirm the same issue?
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    9,021
    Hi,

    the default splashscreen has been changed to black image in beta 14. From notes:

    This means, that you can now set your own splash screen regardless of your license. This also means you must do it, as we no longer provide the default Unity splash screen image.
     
  7. ng-pixels

    ng-pixels

    Joined:
    Dec 29, 2012
    Posts:
    68
    Hi,
    I set my own splash screen and it shows on device but after it I can see only black screen.
     
  8. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    9,021
    The first scene doesn't load right after splashscreen? Or it first shows splashscreen, then shows blackscreen, and then finally loads? Do you have iOS free or pro?
     
  9. ng-pixels

    ng-pixels

    Joined:
    Dec 29, 2012
    Posts:
    68
    It first shows splashscreen but after that screen is black. It doesnt load the scene.
    I have iOS Pro.
     
  10. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    9,021
    Sounds like a bug. Could you report it with a repro attached?
     
  11. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    I have iOS Free and Unity Pro.

    I don't get the unity splash screen, though I get the grey background colour. The screen then just shows a black screen after that.

    Adding debug output to the main update loop shows that the game is running it's update cycle, though it is not working (music is not playing, and touches appear to not register, etc). This was fine in Beta 13 though (as far as I can recall)
     
  12. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    Further testing (to match ng-pixels), I assigned a splash image. Now the splash image does indeed show, but then returns to a black screen thereafter. Was hoping the lack of the splash screen would be an attributing factor - sadly it is not.
     
  13. ng-pixels

    ng-pixels

    Joined:
    Dec 29, 2012
    Posts:
    68
    Newly created project in beta 14 works fine. My project were created in beta 13 or 12.
     
  14. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    So, something is not updating when a project from 13 is opened in 14?

    Sadly, with a project near completion, creating a new project is perhaps not an option?
     
  15. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Have you tried just build, then manually open in xcode and compile? If i was you i would manually make checks in xcode
     
  16. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    Yes, done that
     
  17. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    Ok, I have found a solution (of sorts)

    The issue that causes the 'black screen' is Rotation. In build settings, setting the default orientation from "auto rotation" to a fixed rotation will cause the issue.

    Downside is that when I set it to Auto rotation (even if I omit Portrait) results in the image shown on the iPhone being much larger than it should be with much of what should be visible located off-screen. bugger!

    So, if I allow auto-rotation of the app - it works, but with wrong sized app resolution. If i set device rotation from 'Auto rotation' to any of Portrait, Portrait Upside Down, Landscape Right, or Landscape Left - I get the black screen...

    iOS 8 is a major pain code wise relating to the new calls for rotation. We have struggled with an issue on a current game that needs updating to iOS 8 (game using home-spun engine) where rotation breaks occasionally. So, my guess is that this is iOS8 specific.

    I am using an iPhone 6+ for testing BTW.

    Any help here would be great. ng-pixels, can you replicate this or does the suggestion here help?

    ps. Rotating the device when set to Auto Rotation with Landscape ticked results in an intermittent unity crash at the following Assert.. rotDeg is not a 90degree value.

    Code (CSharp):
    1. ScreenOrientation OrientationAfterTransform(ScreenOrientation curOrient, CGAffineTransform transform)
    2. {
    3.     int rotDeg = (int)(::atan2f(transform.b, transform.a) * (180 / M_PI));
    4.     assert(rotDeg == 0 || rotDeg == 90 || rotDeg == -90 || rotDeg == 180)
    5.  
    6.     if(rotDeg == 0)
    7.     {
    8.         return curOrient;
    9.     }
    10.     else if(rotDeg == 180)
    11.     {
    12.         if(curOrient == portrait)                    return portraitUpsideDown;
    13.         else if(curOrient == portraitUpsideDown)    return portrait;
    14.         else if(curOrient == landscapeRight)        return landscapeLeft;
    15.         else if(curOrient == landscapeLeft)            return landscapeRight;
    16.     }
    17.     else if(rotDeg == 90)
    18.     {
    19.         if(curOrient == portrait)                    return landscapeLeft;
    20.         else if(curOrient == portraitUpsideDown)    return landscapeRight;
    21.         else if(curOrient == landscapeRight)        return portrait;
    22.         else if(curOrient == landscapeLeft)            return portraitUpsideDown;
    23.     }
    24.     else if(rotDeg == -90)
    25.     {
    26.         if(curOrient == portrait)                    return landscapeRight;
    27.         else if(curOrient == portraitUpsideDown)    return landscapeLeft;
    28.         else if(curOrient == landscapeRight)        return portraitUpsideDown;
    29.         else if(curOrient == landscapeLeft)            return portrait;
    30.     }
    31.  
    32.     ::printf("rotation unhandled: %d\n", rotDeg);
    33.     return curOrient;
    34. }
    35.  
     
    Last edited: Dec 6, 2014
  18. ng-pixels

    ng-pixels

    Joined:
    Dec 29, 2012
    Posts:
    68
    Yes, fixed rotation causes the issue.
    Thanks!!!
     
  19. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    You need to have graphic API set to Automatic. Setting to GL2 or GL3 results in a black screen also.

    My main problem now is that everything is rendered bigger than expected. The top left of the screen is in the correct place, but the right and down extents are drawn out of the screen area.

    So, rather odd? What device are you using for testing NG?

    Screen width and height is reporting correctly "1920:1080"
     
  20. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    Also of note, the UI touch responses respond to where the buttons SHOULD be and not where they are displayed?
     
  21. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    9,021
    Did you guys report a bug? It will not be looked into unless we got a repro.
     
  22. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    No. Have not sent a bug report. I actually am not sure how I can with my project? Perhaps create a little project to use as a repro test?

    Is anyone else having this problem? I am not even sure if it is related to iPhone 6+ only? Will get my hands on an iPad and test on that.

    If anyone more knowledgeable knows the best way to submit a report, that would be great. In the mean time going to try and isolate it further. Pretty sure it is related to the addition of iOS 8 support in 14 and the major rotation and screen changes that apple instigated in the framework.
     
  23. ng-pixels

    ng-pixels

    Joined:
    Dec 29, 2012
    Posts:
    68
    iPhone4s iOS 6.1.3 and iPad3 iOS 8. The issue was on both devices.
     
  24. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    Ok. Just done a test on an iPad2 with iOS 8.1 installed and it works correctly there. So, looking like an iPhone 6 issue regarding the resolution problem.
     
  25. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    Ok, so NG, looks like the black issue is not restricted to iOS 8 then. hmmm..

    If the rendering is at correct resolution, then it appears that the resolution problem is indeed confined to the iPhone 6?
     
  26. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    9,021
  27. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    I have submitted a bug report listing the two main issues regarding rendering (black screen and over sized resolution).
     
  28. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    Just been pondering on the render issue on the iPhone 6+

    I wonder if it is rendering to the internal resolution and trying to display that.

    the iPhone 6+ has an internal screen resolution of 1242x2208, though down samples and renders at 1080x1920. It almost appears (in my eyes at least) that unity is displaying a 1242x2208 image on the 1080x1920 screen without any downsampling, resulting in the image presented being larger than the screen with the right and base cut off?
     
  29. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    9,021
    Thanks for the bug report.
     
  30. Vibs_appit

    Vibs_appit

    Joined:
    Feb 16, 2014
    Posts:
    53
    I am having the same issue. I have put all screen sizes for splash image in player settings, but all I can see after my splash is the black screen. The profiler shows the normal activity and I can't see any errors in xcode nslog either. I am baffled. It's running, but not rendering anything. :(

    -------------------------------------------------------------------------------------------------------------------------------
    Update: Just to add, I am running and testing on ipad3 (ios 8.1.1) and ipod touch (5th gen, ios 7.1)
     
  31. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    For now, set device rotation to automatic and rendering to metal.
     
  32. Vibs_appit

    Vibs_appit

    Joined:
    Feb 16, 2014
    Posts:
    53
    Tried that as well.. not working for me.
     
  33. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    Or rendering to automatic in player settings (iOS), same for the automatic rotation.

    If these are both set to automatic, then perhaps there is also another issue? I was under the belief that they were both related to ios8 involving the new metal code and apples total mess up of the existing rotation code - but if you are having the problem in iOS 7, that cannot be the case.

    Perhaps a bug report is worthy?

    Can you post a screen shot of your player settings and I can compare with mine - there may be something I am missing?
     
  34. Vibs_appit

    Vibs_appit

    Joined:
    Feb 16, 2014
    Posts:
    53
     

    Attached Files:

  35. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    The only difference I can see if that I allow rotation in all 4 directions.

    I don't have iOS pro so have no idea if static batching makes a difference, though would not have thought so.
     
  36. thienohs

    thienohs

    Joined:
    Feb 6, 2014
    Posts:
    13
    Same problem here.
    Blackscreen on iOS 8.1 as well.
    I changed setting to Auto Rotation and it worked but experience over sized resolution like Flash80 (with Graphics API set to 2.0, 3.0 or even Metal run on iPhone 6+). It runs fine on iPhone 5 though (I guess because it's not down-scale like the iPhone 6+).

    @Flash80 : Did you find a fix for the over sized problem or you just live with it ? Do you use NGUI ?
     
  37. Vibs_appit

    Vibs_appit

    Joined:
    Feb 16, 2014
    Posts:
    53
    i have it to all side rotation as well.. not working
     
  38. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    I did not find a fix for the oversized resolution. This is certainly a bug in unity's rendering and I am sure the only thing there is to wait for the next beta and keep our fingers crossed.

    I don't use ngui or any other plugins.
     
  39. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    Vibs, I have no idea what to suggest. The things I mention appear to work for others so perhaps there is another issue.

    I would suggest sending a bug report as the only difference I can see is that you are using iOS pro.
     
  40. Vibs_appit

    Vibs_appit

    Joined:
    Feb 16, 2014
    Posts:
    53
    I guess.. I will create a repro project and file a bug.
     
  41. Vibs_appit

    Vibs_appit

    Joined:
    Feb 16, 2014
    Posts:
    53
    @Flash80 : Apparantly I had changed the orientation rotation thing to all sides when I had changed the rendering from automatic to something else. So it was just a wrong combo than you suggested. Set all things to automatic and it works now. Bummer about the rotation, but at least I can work with my build and test it. Let's wait for the new beta for this to be fixed. :)
     
  42. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    484
    It seems the black screen bug have not fix in Beta15 neither.
     
    RustyFlash likes this.
  43. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    Nope.

    There are three bugs within this post.

    1) Setting to locked rotation (non-automatic) results in a black screen
    2) Selecting GL2 or GL3 (non-automatic) results in a black screen
    3) The rendering on the iPhone 6+ is oversized, instead rendering to the iPhone 6+'s internal resolution rather than the screen resolution.

    All three points were in the bug report I sent, and none of them have been fixed (the 6+ one should be a simple internal fix)

    A major disappointment. This means (though it is not advisable to release an iOS app using beta software) that releasing a build to the App Store would result in problems for users of the iPhone 6+ (if you cannot test your game on the 6+, don't release anything).

    Tautvydas Zilys, any news regarding these rather severe issues?

    I am keen to use GL2/3 as my shader renders white using metal for some reason? I am not a shader whizz so perhaps I should post the shader in the hope of someone knowing how to get it working again?

    Going to stand in a corner and sulk for a bit :(
     
    Vibs_appit and Luckymouse like this.
  44. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    Anyone else still having these problems?

    Any news on a solution?
     
  45. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    9,021
    Hi,

    we did receive the bug report. iOS team is looking into it.
     
    RustyFlash likes this.
  46. Ospa

    Ospa

    Joined:
    Nov 27, 2012
    Posts:
    10
    I fixed the scaling issue on iPhone 6+ by modifying DisplayManager.mm line 146.
    Changed the screen.scales to _view.contentScaleFactor

    Don't know if this is correct way, but it seems to work for now until official fix is released.
     
  47. RustyFlash

    RustyFlash

    Joined:
    Oct 8, 2014
    Posts:
    88
    Well spotted Ospa and thanks for sharing.
     
  48. Marteleto

    Marteleto

    Joined:
    Dec 4, 2014
    Posts:
    2
    Hey guys, I think you are either kinda confused or my case is specific:

    The black screen occurs on any project newly created or not. It is caused(from what appears) by the Unity Engine not calculating the screen transform after it loads the scene.

    The black screen "disappears" if the user manually changes the device orientation(rotate the device with his hands), thus forcing the engine to recalculate the screen transform.

    Before that happens, the OrientationAfterTransform (on OrientationSupport.mm) method is called to check what is the new orientation. However, there is a testcase not covered by this implementation, which is rotDeg bein MINUS 180 (-180)

    This is easily fixed by changing this line

    else if(rotDeg == 180)

    to this

    else if(rotDeg == 180 || rotDeg == -180)

    And commenting that assert case (what is it doing there???). It will fix the crash, but not the black screen.

    For the mod asking for repro steps: COME. ON. Running an new project with a cube in the scene on any iOS device will cause the issue. This build shouldn't have met daylight.
     
  49. Ospa

    Ospa

    Joined:
    Nov 27, 2012
    Posts:
    10
    Ok, quick hack for the black screen bug.

    For us it happened only on devices with iOS 7.x.x and this seems to fix it.

    In UnityViewControllerBase.mm add following to the init before returning:

    UIInterfaceOrientation curOrientation = self.interfaceOrientation;
    [GetAppController() interfaceWillChangeOrientationTo:curOrientation];
     
  50. D-Lask

    D-Lask

    Joined:
    May 18, 2013
    Posts:
    7
    Thanks so much for posting this fix- I was totally at a loss with this bug.

    I made a patching script in a similar vein to the one found here: https://gist.github.com/robertcastle/94ef363259b9e66f81fd

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3. using UnityEditor.Callbacks;
    4.  
    5. using System.IO;
    6. using System.Collections.Generic;
    7.  
    8. public class IOSBetaOrientationPatcher : Editor
    9. {
    10.     [PostProcessBuild]
    11.     public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
    12.     {
    13.         if (target != BuildTarget.iPhone) {
    14.             return;
    15.         }
    16.  
    17.         PatchFile(pathToBuiltProject,
    18.                   "UnityViewControllerBase.mm",
    19.                   "return self;",
    20.                   "\t[GetAppController() interfaceWillChangeOrientationTo: self.interfaceOrientation];\n"
    21.                   + "\treturn self;");
    22.  
    23.         PatchFile(pathToBuiltProject,
    24.                   "OrientationSupport.mm",
    25.                   "else if(rotDeg == 180)",
    26.                   "\telse if(rotDeg == 180 || rotDeg == -180)");
    27.     }
    28.  
    29.     static void PatchFile(string pathToBuiltProject, string fileName, string lineToPatch, string patchFix)
    30.     {
    31.         string[] files = Directory.GetFiles(pathToBuiltProject, fileName, SearchOption.AllDirectories);
    32.  
    33.         if (files == null || files.Length <= 0)
    34.         {
    35.             Debug.LogError("Could not find " + fileName);
    36.             return;
    37.         }
    38.  
    39.         string filePath = files[0];
    40.         List<string> content = new List<string>(File.ReadAllLines(filePath));
    41.  
    42.         int index = 0;
    43.         bool doPatch = true;
    44.  
    45.         for (int i = 0; i < content.Count; i++)
    46.         {
    47.             string line = content[i];
    48.  
    49.             if (line.Contains(patchFix))
    50.             {
    51.                 doPatch = false;
    52.                 break;
    53.             }
    54.  
    55.             if (line.Contains(lineToPatch))
    56.             {
    57.                 index = i;
    58.                 break;
    59.             }
    60.         }
    61.  
    62.         if (doPatch)
    63.         {
    64.             Debug.Log("Patching " + fileName);
    65.             content[index] = patchFix;
    66.             File.WriteAllLines(filePath, content.ToArray());
    67.         }
    68.         else
    69.         {
    70.             Debug.Log(fileName + " patch already applied. Skipping.");
    71.         }
    72.     }
    73. }
     
    getwreckedgame and Marteleto like this.
unityunity