日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

Unity设置AppIcon方法

發布時間:2025/5/22 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Unity设置AppIcon方法 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

制作unity自動打包工具時,不同的渠道需要不同的AppIcon,在網上找了方法,記錄下

Unity4.6測試可用,Unity2017.2.0測試不可用

代碼:

public void SetDefaultIcon(){
     Texture2D texture = AssetDatabase.LoadAssetAtPath(string.Format("Assets/AppIcon/{0}.png", "appicon"), typeof(Texture2D)) as Texture2D;MethodInfo getIconFormPlatform
= typeof(PlayerSettings).GetMethod("GetIconsForPlatform", BindingFlags.NonPublic | BindingFlags.Static);MethodInfo getIconSizesForPlatform = typeof(PlayerSettings).GetMethod("GetIconSizesForPlatform", BindingFlags.NonPublic | BindingFlags.Static);MethodInfo setIconsForPlatform = typeof(PlayerSettings).GetMethod("SetIconsForPlatform", BindingFlags.NonPublic | BindingFlags.Static);Texture2D[] textureArray = (Texture2D[])getIconFormPlatform.Invoke(null, new object[] { string.Empty });var iconSizesForPlatform = (int[])getIconSizesForPlatform.Invoke(null, new object[] { string.Empty });if (textureArray.Length != iconSizesForPlatform.Length){textureArray = new Texture2D[iconSizesForPlatform.Length];setIconsForPlatform.Invoke(null, new object[] { string.Empty, textureArray });}
     textureArray[0] = texture;setIconsForPlatform.Invoke(
null, new object[] { string.Empty, textureArray });AssetDatabase.SaveAssets();}

?自己摸索了下,折騰出2017下修改APPIcon方法

private void _setDefaultIcon(string iconName){Texture2D texture = AssetDatabase.LoadAssetAtPath(string.Format("Assets/Images/Icon/{0}.png", iconName),typeof(Texture2D)) as Texture2D;int[] iconSize = PlayerSettings.GetIconSizesForTargetGroup(BuildTargetGroup.Android);Texture2D[] textureArray = new Texture2D[iconSize.Length];for (int i = 0; i < textureArray.Length; i++){textureArray[i] = texture;}textureArray[0] = texture;PlayerSettings.SetIconsForTargetGroup(BuildTargetGroup.Android, textureArray);AssetDatabase.SaveAssets();}

?

轉載于:https://www.cnblogs.com/Yellow0-0River/p/9208278.html

《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀

總結

以上是生活随笔為你收集整理的Unity设置AppIcon方法的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。