I'm trying to set My Player Icons by script, but when I run the script it does nothing, and I'm not getting any errors. This is my code:
public void SetPlayerIcons()
{
var iconSizes = PlayerSettings.GetIconSizesForTargetGroup(BuildTargetGroup.iOS);
var icons = new Texture2D[iconSizes.Length];
for (var i = 0; i < iconSizes.Length; i++)
{
var iconPath = Path.Combine("Assets", BookIconsPath);
var assetPath = iconPath+"/Icon_"+iconSizes[i]+".png";
Debug.Log("assetPath: "+assetPath);
try
{
icons[i] = AssetDatabase.LoadAssetAtPath<Texture2D>(assetPath);
if (icons[i] == null)
Debug.LogError("Unable to load icon at "+ assetPath+" due to asset not found");
}
catch (System.Exception e)
{
Debug.LogError("Unable to load icon at "+ assetPath+" due to asset not found");
Debug.LogError("Exception:" + e);
}
}
PlayerSettings.SetIconsForTargetGroup(BuildTargetGroup.iOS,icons);
}
Can someone help me with that? What am I doing wrong?
Thank