- Home /
Question by
Kaltik · Sep 28, 2017 at 09:55 AM ·
buildplayer settingsplayersettingsicons
Issue with modifying app icons set programmatically.
Hello! I'm trying to set Icons for my application in BuildScript. But it seems that nothing happend and icons didn't set. here's code example I'm using:
private static void SetPlayerSettings()
{
Texture2D icon1024 = AssetDatabase.LoadMainAssetAtPath("path/icon.png") as Texture2D;
int[] sizeList = PlayerSettings.GetIconSizesForTargetGroup(BuildTargetGroup.Standalone);
Texture2D[] iconList = new Texture2D[sizeList.Length];
for (int i = 0; i < sizeList.Length; i++)
{
int iconSize = sizeList[i];
iconList[i] = Texture2D.Instantiate(icon1024);
iconList[i].Resize(iconSize, iconSize, TextureFormat.ARGB32, false);
}
PlayerSettings.productName = APP_NAME;
// set default icon and app icons
PlayerSettings.SetIconsForTargetGroup(BuildTargetGroup.Unknown, new Texture2D[] { icon1024 });
PlayerSettings.SetIconsForTargetGroup(BuildTargetGroup.Standalone, iconList);
}
And after that function above I do next:
SetPlayerSettings();
string[] scenes = FindEnabledEditorScenes();
EditorUserBuildSettings.SwitchActiveBuildTarget(buildTarget);
string res = BuildPipeline.BuildPlayer(scenes, targetDir, buildTarget, CurrentBuildOptions);
if (res.Length > 0)
{
throw new Exception("BuildPlayer failure: " + res);
}
When I open my PlayerSettings there is nothing happend too. But when i uncheck Override for Standalone checkbox, my Icons appear. Please, could someone tell me what I do wrong? Unity version 5.3.6f1
Comment