iOS Lightmode bug (filed)

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


2 Likes

I suspect it’s related to this change in 2021.1.28:

  • iOS: Fixed an issue where dark mode native mobile input’s background from going transparent when was empty. (1367091)

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 ?

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 …

1 Like

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.

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 :slight_smile:

I’ve found a simple repro for this general issue: an empty scene with only a camera that has a non-white “clear” color. With light mode the screen is white, with dark mode the screen is of the selected clear color. Here’s the public bug, affects Unity 2019 to 2022: Unity Issue Tracker - "Main Camera" background color is white when the device Appearance setting is "Light"

2 Likes

Thanks for doing that boss and saving others time. Been slammed and couldn’t make time for that.

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

Still present in 2021.2.5 URP, both iOS 14 &15

I’ve uploaded a repro project — see case 1385738:

https://fogbugz.unity3d.com/default.asp?1385738_bi74vlliq8kc4a09

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

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.

#if UNITY_IOS

using System.IO;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;

public static class iOSOnPostprocessBuild
{
    [PostProcessBuild(100)]
    public static void OnPostprocessBuild(BuildTarget target, string pathToBuildProject)
    {
        if (target == BuildTarget.iOS)
        {
            var plistPath = Path.Combine(pathToBuildProject, "Info.plist");
            var plist = new PlistDocument();
            plist.ReadFromString(File.ReadAllText(plistPath));

            plist.root.SetString("Appearance", "Dark");

            File.WriteAllText(plistPath, plist.WriteToString());
        }
    }
}

#endif


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?

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.

@PandaArcade … instead of “Appearance” you need to use “UIUserInterfaceStyle”

1 Like

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 :wink:

1 Like

Oh ok thanks :smile:

On my end, it doesn’t work with
UIUserInterfaceStyle = Dark
instead it only works with
Appearance = Dark
(Unity 2019.4.34f1)

1 Like

Have you managed to solve this issue ? I use Cloud build for making builds - this bug exist no matter what unity version i choose…

1 Like

For me isnt working with Appearance dark in info.plist, also, is already include this value by default