制作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

Unity设置AppIcon方法相关推荐

  1. (转)[EntLib]微软企业库5.0 学习之路——第十步、使用Unity解耦你的系统—PART2——了解Unity的使用方法(1)...

    原文地址:http://www.cnblogs.com/kyo-yo/archive/2010/11/01/Learning-EntLib-Tenth-Decoupling-Your-System-U ...

  2. Unity插件使用方法

    Unity插件使用方法 EPPlus(Excel读写) Default Playables PlayableGraph Visuallizer Recorder(录屏工具) EPPlus(Excel读 ...

  3. Unity动画触发方法总结

    Unity动画触发方法总结 需求 UI动画希望玩家点击一次就播放一次 一.SetActive 这种情况需要在动画播放完毕后,将animator所在 gameobject设置为 inactive:或者在 ...

  4. Unity数据存储方法

    Unity数据存储方法 首先Unity中共有五种数据存储的方法, 一.PlayerPrefs 二.读取普通文本资源:TextAsset 三.Json 四.XML存储 五.Sqlite牵涉到的Sqlit ...

  5. tplink路由器dns服务器未响应,小米路由器AC2100恢复出厂设置的方法

    要把已经设置好的小米路由器AC2100恢复出厂设置重新设置,我该怎么办? 路由器恢复出厂设置一般有三种方法 APP恢复出厂设置 手动恢复出厂设置 浏览器恢复出厂设置 这里就介绍最简单快捷的手动恢复出 ...

  6. CentOS 6/7 忘记root密码,重新设置的方法

    为什么80%的码农都做不了架构师?>>>    CentOS 6.x设置方法 CentOS 7.x设置方法 CentOS 6.x设置方法 在虚拟机安装了Centos,今天要开机却忘记 ...

  7. 2010.2--netscreen ssg 140 恢复出厂设置的方法

    netscreen  ssg  140 恢复出厂设置的方法 1. 找到后面板上的重置针孔.使用又细又硬的金属丝 ( 例如回形针),推压针孔四至六秒然后松开. STATUS LED 闪烁红色.控制台上的 ...

  8. Redis 配置连接池,redisTemplate 操作多个db数据库,切换多个db,解决JedisConnectionFactory的设置连接方法过时问题。(转)

    Redis 配置连接池,redisTemplate 操作多个db数据库,切换多个db,解决JedisConnectionFactory的设置连接方法过时问题.(转) 参考文章: (1)Redis 配置 ...

  9. php路径设置,php进行数据库路径设置的方法

    php进行数据库路径设置的方法 发布时间:2020-11-09 09:49:03 来源:亿速云 阅读:99 作者:小新 小编给大家分享一下php进行数据库路径设置的方法,希望大家阅读完这篇文章后大所收 ...

最新文章

  1. 解决Jira和Confluence访问打开越来越缓慢问题
  2. 如何将NSString转换为NSNumber
  3. AA065VD时序的确定
  4. php protected 的继承,14 PHP 类的继承 [public protected private] parent 构造方法 析构方法 重写 最终类和方法 设计模式...
  5. A good memory allocator is everything that I need
  6. 【iCore1S 双核心板_FPGA】例程十二:基于单口RAM的ARM+FPGA数据存取实验
  7. linux 复用寄存器,I/O多路复用一些概念
  8. maven错误解决:编码GBK的不可映射字符
  9. leetcode题解167-两数之和 II - 输入有序数组
  10. unity摄影机depth模式_[蛮牛教程] Unity3D 浅析-Camera(摄像机)
  11. 公司用的非标普通自动化用单片机还是plc_高级电气自动化工程师必备十大技能...
  12. %3cp%3e 修改 值 html,UEditor在JavaWeb中的应用
  13. 皮卡丘忠实粉丝之Web实现操作系统实验(进程调度+存储管理+死锁避免银行家算法)
  14. Allan方差读图分析IMU误差指标
  15. 移动应用程序开发_移动应用程序开发生命周期-从开发到应用程序商店的应用程序之旅
  16. python bytes与str之间的转换 hex的字符转换
  17. 项目经理如何面对困境
  18. Chrome浏览器查看、找回保存的网站账户密码
  19. 当前已提供的各国NTP服务器列表
  20. activity从底部弹出动画

热门文章

  1. autodesk powerinspect ultimate 2021中文版
  2. plaxis 2d 2020中文版
  3. ORA-01036: 非法的变量名/编号
  4. 数据结构基础温故-6.查找(下):哈希表
  5. Appium+python 测试环境搭建
  6. Nginx详解五:Nginx基础篇之HTTP请求
  7. python-之基本语法
  8. 架构评审方法和思路总结
  9. PHP函数之日期时间函数date()使用详解
  10. ubuntu/debian/centos/rhel使用镜像源一键安装gitlab-ce服务