Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug iOS Lightmode bug (filed)

Discussion in 'iOS and tvOS' started by plan-systems, Nov 26, 2021.

  1. plan-systems

    plan-systems

    Joined:
    Mar 8, 2020
    Posts:
    44
    Hi friends,

    I filed a bug this morning on an iOS issue that showed up in 2021.1.28 (1.27 did not exhibit this issue). It escapes me how iOS light mode would have any affect on the content area of the Unity iOS player app.

    https://fogbugz.unity3d.com/default.asp?1383955_3cboicnvpuh33j4i

    Issue:
    iOS shows light background in App when iOS set to Light Mode (see attached screen shots). When iOS is in dark mode, no whiteness.

    Regression:
    - Occurs with 2021.1.28 & 2021.2.4
    - Does *NOT* occur with 2021.1.27
    - Occurs consistently on iOS 13.5.1 and 14.8.
    - Occurs regardless of PlayerSettings > iOS > Status Bar Style > Light *OR* Default
     

    Attached Files:

    ramzx and odysoftware like this.
  2. plan-systems

    plan-systems

    Joined:
    Mar 8, 2020
    Posts:
    44
  3. odysoftware

    odysoftware

    Joined:
    Jul 21, 2015
    Posts:
    84
    I have just updated to Unity 2020.3.23 and having the exact same issue, suddenly my complete game color's change when using light mode - where it should always look like in dark mode !? How can I change this ?
     
  4. odysoftware

    odysoftware

    Joined:
    Jul 21, 2015
    Posts:
    84
    Was able to fix it when using Appearance = "Dark" plist parameter in Xcode to force the game to "Dark" mode. But this was never necessary before and I think this should not affect the unity player... ! Also interesting why I needed the dark mode for my game and everything was wrong with "Light" mode ...
     
    PandaArcade likes this.
  5. SmoothD

    SmoothD

    Joined:
    Nov 19, 2017
    Posts:
    1
    Hey - I noticed this too with my latest iOS build on 2020.3.23f1. The app will not render any black colors when the iOS Appearance setting is set to Light. When I set it to Dark under Settings > Display & Brightness then my app looks correct.

    How do I add that Appearance = "Dark" in the plist? I have never touched the plist file.
     
  6. odysoftware

    odysoftware

    Joined:
    Jul 21, 2015
    Posts:
    84
    In Xcode under the "info" tab - there are many parameters (line by line) ... there you can add one with the little + and then enter Apperance and for the value use "Dark" - that forces the app to use the dark mode :)
     
  7. xyome

    xyome

    Joined:
    Jul 4, 2014
    Posts:
    9
    chrismarch and plan-systems like this.
  8. plan-systems

    plan-systems

    Joined:
    Mar 8, 2020
    Posts:
    44
    Thanks for doing that boss and saving others time. Been slammed and couldn't make time for that.
     
  9. odysoftware

    odysoftware

    Joined:
    Jul 21, 2015
    Posts:
    84
    Thanks for doing the report ‍♂️ and making them aware of this - meanwhile you can just use my workaround - it works fine if you force dark mode
     
  10. plan-systems

    plan-systems

    Joined:
    Mar 8, 2020
    Posts:
    44
    Still present in 2021.2.5 URP, both iOS 14 &15
     
  11. plan-systems

    plan-systems

    Joined:
    Mar 8, 2020
    Posts:
    44
  12. Deleted User

    Deleted User

    Guest

    As long as I can tell, this bug is affecting all of my shaders! It's not just the keyboard and the Camera background...
     
  13. PandaArcade

    PandaArcade

    Joined:
    Jan 2, 2017
    Posts:
    126
    So I'm trying to automate the adding of the Appearance entry to my plist but it only partially works.
    It is added to my Xcode projects plist but it doesn't force my game to run in dark mode. If I add it manually in Xcode it works.

    Code (CSharp):
    1. #if UNITY_IOS
    2.  
    3. using System.IO;
    4. using UnityEditor;
    5. using UnityEditor.Callbacks;
    6. using UnityEditor.iOS.Xcode;
    7.  
    8. public static class iOSOnPostprocessBuild
    9. {
    10.     [PostProcessBuild(100)]
    11.     public static void OnPostprocessBuild(BuildTarget target, string pathToBuildProject)
    12.     {
    13.         if (target == BuildTarget.iOS)
    14.         {
    15.             var plistPath = Path.Combine(pathToBuildProject, "Info.plist");
    16.             var plist = new PlistDocument();
    17.             plist.ReadFromString(File.ReadAllText(plistPath));
    18.  
    19.             plist.root.SetString("Appearance", "Dark");
    20.  
    21.             File.WriteAllText(plistPath, plist.WriteToString());
    22.         }
    23.     }
    24. }
    25.  
    26. #endif
    Result.png
    You can see that when I add the Appearance entry via code the string label isn't greyed out but it is when I enter it manually. Can someone please tell me why my code doesn't work?
     
  14. mingos77

    mingos77

    Joined:
    Dec 6, 2021
    Posts:
    4
    I have run into the same problem.
    I'm using the 2019 version.
    I had this problem when I updated my Unity version.

    Normal: 2019.4.32f1
    Problem: 2019.4.33f1

    Only the iOS build was done with 2019.4.32f1 to avoid the problem.
     
  15. snorrsi

    snorrsi

    Joined:
    Jan 30, 2017
    Posts:
    12
    @PandaArcade .. instead of "Appearance" you need to use "UIUserInterfaceStyle"
     
    PandaArcade likes this.
  16. odysoftware

    odysoftware

    Joined:
    Jul 21, 2015
    Posts:
    84
    Yes snorrsi is right Appearance is just a synonym for UIUserInterfaceStyle - for now I am just doing it manually in XCode upon release and hope that at some point Unity resolves it... because this is definitely a bug ;)
     
    PandaArcade likes this.
  17. PandaArcade

    PandaArcade

    Joined:
    Jan 2, 2017
    Posts:
    126
    Oh ok thanks :D
     
  18. blastproofgames

    blastproofgames

    Joined:
    Apr 3, 2014
    Posts:
    18
    On my end, it doesn't work with
    UIUserInterfaceStyle = Dark
    instead it only works with
    Appearance = Dark
    (Unity 2019.4.34f1)
     
    IndieFist likes this.
  19. astanid

    astanid

    Joined:
    Apr 5, 2021
    Posts:
    145
    Have you managed to solve this issue ? I use Cloud build for making builds - this bug exist no matter what unity version i choose...
     
    balloon_kondo likes this.
  20. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    518
    For me isnt working with Appearance dark in info.plist, also, is already include this value by default
     
  21. dooderino

    dooderino

    Joined:
    Mar 2, 2014
    Posts:
    5
    Last edited: Jan 17, 2022
    balloon_kondo likes this.
  22. odysoftware

    odysoftware

    Joined:
    Jul 21, 2015
    Posts:
    84
    It appears to be solved already? At least in Unity 2021.2f8
     
  23. OXSIONSOFT

    OXSIONSOFT

    Joined:
    May 26, 2016
    Posts:
    23
    I had the same problems. Unity 2021.2.7f1 / Xcode 13.2.1. On all iOS devices (14.x - 15.x).
    It's not just a white background. It also messed up a lot of shaders. Almost all the PNG inside the scene had a faded appearance and not the correct transparency.
    It worked if you set a dark theme in the iOS settings. If you put a white theme, then everything looks terrible.
    As wrote above, this worked for me (You have to manually add this to info.plist): Appearance = Dark
    Then it works correctly regardless of the chosen theme for iOS
     
    ramzx likes this.
  24. astanid

    astanid

    Joined:
    Apr 5, 2021
    Posts:
    145
    I ran into this bug again after upgrading from Collaborate to Plastic SCM. I used post build script before
    // Set the description key-value in the plist:
    plistRoot.SetString("Appearance", "Dark");
    But it doen't help anymore :( Any ideas ?
     
  25. dooderino

    dooderino

    Joined:
    Mar 2, 2014
    Posts:
    5
    Try:

    plistRoot.SetString("UIUserInterfaceStyle", "Dark");
     
  26. astanid

    astanid

    Joined:
    Apr 5, 2021
    Posts:
    145
    thanks that helped
     
    dooderino likes this.
  27. astanid

    astanid

    Joined:
    Apr 5, 2021
    Posts:
    145
    Got same problem with another project. Unity 2021.1.28f
    I tried
    plistRoot.SetString("Appearance", "Dark");
    plistRoot.SetString("UIUserInterfaceStyle", "Dark");

    Tried changing color space from gamma to liniar. Nothing helped :(
    upload_2022-5-22_14-24-43.png upload_2022-5-22_14-25-13.png
    Dark result iOS, bright Editor and iOS
    It was working fine 2 moths ago before upgrading to Plastic...
     
  28. unitynoob24

    unitynoob24

    Joined:
    Dec 27, 2014
    Posts:
    398
    Just encountered this for the first time today. Unity version 2020.3.24f1(LTS) running build on iPhone 6s+ I was working on a prototype app and the entire canvas is just non-image fill sprites with varying colors and alpha and anything that should be slightly transparent is just 100% white. It works fine in editor on macbook, my windows machine and my android devices. Switching iPhone to dark mode fixes the issue, but kinda annoying. :/