[Unity 2021] Setting the Default Icon via script?

Hey there!

In Unity 2020, you could set the default icon in the Project Settings with this code:

PlayerSettings.SetIconsForTargetGroup(BuildTargetGroup.Unknown, new Texture2D[] {defaultIcon});

However, in Unity 2021, PlayerSettings.SetIconsForTargetGroup is marked as deprecated and it’s recommended to use the PlayerSettings.SetIcons method. But that doesn’t seem to be having the desired effect. Trying to set the icon for Build.NamedBuildTarget.Unknown just results in a console error and setting for any other platform doesn’t change the icon shown in Project Settings.

Does anyone know how to do this now in Unity 2021?

Thanks!

Hello, I have the same problem now, do you have a solution now? Thanks!

Hi, this was a regression that was introduced in an alpha version of 2021.2.0. The good news is that this has been fixed in 2022.2.0a1, and there is also a backport in progress to 2021.2. You can track its progress here: https://issuetracker.unity3d.com/issues/android-the-default-icon-does-not-get-successfully-changed-to-another-icon