我正在尝试按脚本设置我的播放器图标, 但是当我运行脚本时它什么也没做, 而且我没有收到任何错误。 这是我的代码:
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);
}
有人可以帮我吗? 我做错了什么?
感谢