码迷,mamicode.com
首页 > 移动开发 > 详细

Unity设置AppIcon方法

时间:2018-06-21 13:39:32      阅读:361      评论:0      收藏:0      [点我收藏+]

标签:ati   saveas   app   代码   flags   tde   bind   mat   binding   

制作unity自动打包工具时,不同的渠道需要不同的AppIcon,在网上找了方法,记录下

代码:

    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 }); } setIconsForPlatform.Invoke(null, new object[] { string.Empty, textureArray }); AssetDatabase.SaveAssets(); }

 

Unity设置AppIcon方法

标签:ati   saveas   app   代码   flags   tde   bind   mat   binding   

原文地址:https://www.cnblogs.com/Yellow0-0River/p/9208278.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!