# Setting adaptive icon for Android from script(C#)

Want to set adaptive icon for Android from script.
I am using Unity example: https://docs.unity3d.com/ScriptReference/PlayerSettings.SetPlatformIcons.html so, what am I doing:

     void Start()
{
Texture2D[][] jaggedArray =
{
};

SetIcons(jaggedArray);
}

void SetIcons(Texture2D[][] textures)
{
var platform = BuildTargetGroup.Android;

var icons = PlayerSettings.GetPlatformIcons(platform, kind);

//Assign textures to each available icon slot.
for (var i = 0; i < icons.Length; i++)
{
icons[i].SetTextures(textures[i]);
}
PlayerSettings.SetPlatformIcons(platform, kind, icons);
}


What am I doing wrong, coz I am getting InvalidOperationException?

• Where is the exception being thrown? What's the full text of the error message? – DMGregory Dec 14 '18 at 13:03
• Also, it's a bit unusual to call this in Start, since that's a MonoBehaviour message that's fired at runtime. SetPlatformIcons is in the UnityEditor namespace, so I'd expect this to be done via an editor script when you're editing your project. It might not be valid to call at runtime. – DMGregory Dec 14 '18 at 16:46