当前位置: 首页 > news >正文

义乌做公司网站国外 网站页面

义乌做公司网站,国外 网站页面,wordpress无法登陆,网站开发的推荐参考书图片资源冗余#xff1a; UPR unity的性能优化工具检查资源 1.检查纹理读/写标记 开启纹理资源的读/写标志会导致双倍的内存占用 检查Inspector - Advanced - Read/Write Enabled选项 2.检查纹理资源alpha通道 如果纹理的alpha通道全部为0#xff0c;或者全部为2…图片资源冗余 UPR unity的性能优化工具检查资源 1.检查纹理读/写标记 开启纹理资源的读/写标志会导致双倍的内存占用 检查Inspector - Advanced - Read/Write Enabled选项 2.检查纹理资源alpha通道 如果纹理的alpha通道全部为0或者全部为255可以认为其中不包含有效信息此时应禁用’Alpha源’标志否则会浪费这部分的内存。 检查Inspector - Alpha Source选项 3.检查纯色纹理 纯色纹理的使用可能可以由一些设置来代替。由于某些情况下纯色纹理是必不可少的此警告仅会在所使用的纹理较大(大于设定值, 默认为16x16)时才会触发。 Custom Parameters: heightThreshold : 16widthThreshold : 16 4.检查重复纹理 问题1 方案可继承AssetPostprocessor对资源改动的时候检查是否有开启读/写标记 问题23 4 方案定期检查 其中问题23只需要判断颜色通道比较简单不做解释 问题4 解决 1.遍历所有贴图 用字典缓存 找到重复的资源 2.找到项目下所有材质并且缓存 3.找到引用该重复贴图的材质 4.判断该材质所有引用贴图字段 如有和重复贴图相同 则替换 5.删除重复贴图 代码 static void RemoveReportTexture(string[] searchInFolders){Dictionarystring, string md5dic new Dictionarystring, string();HashSetint deleteTexInsId new HashSetint();//string[] guids AssetDatabase.FindAssets(t:Texture, new string[] { Assets/actor, Assets/FX, Assets/scene, });string[] guids AssetDatabase.FindAssets(t:Texture, searchInFolders);string[] matFiles null;string[] matFilesContent null;//Debug.Log(贴图 guids.Length);//1.遍历所有贴图 用字典缓存 找到重复的资源 int progress 0;foreach (var assetGuid in guids){string assetPath AssetDatabase.GUIDToAssetPath(assetGuid); // 从GUID拿到资源的路径bool isCancel EditorUtility.DisplayCancelableProgressBar(移除重复的贴图, assetPath, (float)progress / (float)guids.Length);progress;string md5 GetMD5Hash(Path.Combine(Directory.GetCurrentDirectory(), assetPath)); //获取md5string path;md5dic.TryGetValue(md5, out path);if (path null){md5dic[md5] assetPath;// Debug.Log(assetPath);}else{Debug.LogFormat(资源重复{0}{1}, path, assetPath);if (matFiles null){//2.找到所有材质并且缓存Liststring withoutExtensions new Liststring() { .mat };matFiles Directory.GetFiles(Application.dataPath, *.*, SearchOption.AllDirectories).Where(s withoutExtensions.Contains(Path.GetExtension(s).ToLower())).ToArray();matFilesContent new string[matFiles.Length];for (int i 0; i matFiles.Length; i){matFilesContent[i] File.ReadAllText(matFiles[i]);}}Texture2D tex AssetDatabase.LoadAssetAtPathTexture2D(path); //保留的图Texture2D deleteTex AssetDatabase.LoadAssetAtPathTexture2D(assetPath); //删除的图//3.找到引用该贴图的所有材质for (int startIndex 0; startIndex matFiles.Length; startIndex){string file GetRelativeAssetsPath(matFiles[startIndex]);if (Regex.IsMatch(matFilesContent[startIndex], assetGuid)){Material material AssetDatabase.LoadAssetAtPathMaterial(file);bool isUseTex false;var textureNames material.GetTexturePropertyNames();//Debug.Log(遍历所有需要修改替换贴图的材质 file ,贴图数: textureNames.Length);//4.判断该材质所有引用贴图字段 如有和重复贴图相同 则替换for (int j 0; j textureNames.Length; j){if (material.HasTexture(textureNames[j])) // 该方法获取不到不属于该shader的贴图切换材质后unity会保留之前shader的信息{Texture texture material.GetTexture(textureNames[j]); // 获取材质上的贴图引用if (texture ! null){//Debug.Log(获取到图片名字 texture.name);if (texture.name deleteTex.name){isUseTex true;material.SetTexture(textureNames[j], tex);Debug.Log(修改的材质 file 的贴图 assetPath ,assetGuid: assetGuid ,替换为 path 修改材质propertyName textureNames[j]);EditorUtility.SetDirty(material);}}}}}}//5.替换完所有材质删除该重复贴图//if(isChangeSucceedCount ! referencesMatPath.Count)//{// Debug.LogError(修改失败isChangeSucceedCount isChangeSucceedCount referencesMatPath.Count referencesMatPath.Count);//}//else//{// AssetDatabase.DeleteAsset(assetPath);// Debug.LogError(修改成功);//}Debug.Log(DeleteAsset: assetPath);deleteTexInsId.Add(deleteTex.GetInstanceID());AssetDatabase.DeleteAsset(assetPath);}}AssetDatabase.SaveAssets();EditorUtility.ClearProgressBar();if (deleteTexInsId.Count 0){int checkProgress 0;for (int startIndex 0; startIndex matFiles.Length; startIndex){string file GetRelativeAssetsPath(matFiles[startIndex]);bool isCancel EditorUtility.DisplayCancelableProgressBar(检查材质是否缺少贴图, file, (float)checkProgress / (float)matFiles.Length);checkProgress;Material material AssetDatabase.LoadAssetAtPathMaterial(file);SerializedObject serializedMaterial new SerializedObject(material);SerializedProperty texturesProperty serializedMaterial.FindProperty(m_SavedProperties.m_TexEnvs);foreach (SerializedProperty textureProperty in texturesProperty){string propertyName textureProperty.displayName;SerializedProperty textureReference textureProperty.FindPropertyRelative(second.m_Texture);// 检查贴图引用是否丢失if (material.shader.FindPropertyIndex(propertyName) 0 textureReference.objectReferenceValue null deleteTexInsId.Contains(textureReference.objectReferenceInstanceIDValue)){Debug.LogError($移除重复的模型贴图导致 Missing texture in material: {material.name}, Property: {propertyName});}}}EditorUtility.ClearProgressBar();}} 主界面图集过多 主界面UI也就几个界面但通过unity的Memory Profiler去看内存的时候 却发现了30个左右的图集原因是因为拼接资源的时候没注意导致一个界面依赖了好几个图集简单解决就是把主界面和其他界面一起用到的图片放到公用图集里去然后就调整对应的图集代码界面
http://www.hkea.cn/news/14395641/

相关文章:

  • 宁波网站建设设计公司信息电脑游戏排行榜2020前十名
  • 定制网站大概多少钱网站推广站点建设与策划
  • 网站建设空间空间有几种类型手机免费个人网站建站
  • 刘强东自己做网站临沂百度公司地址
  • 手表到哪个网站买网站的动画效果代码大全
  • 石家庄移动端网站建设做黑彩网站能赚钱吗
  • 万和城网站wordpress如何正常打开二级菜单
  • 领动营销网站建设wordpress登录按钮
  • 德州哪里有做网站的WordPress句子主题
  • 自适应型网站建设怎么做淘宝优惠券的网站
  • 三河网站建设-七天网络百度模板网站模板
  • 做网站前需要准备什么软件wordpress metaslider
  • 网站系统升级需要多久怎么做抽奖网站
  • 做pos机网站有必要么技术支持上海网站建设
  • 黄冈网站建设公司制作网站wordpress主题 dux主题5.3
  • 沈阳市城乡建设网站黄骅市有什么好玩的地方
  • 兼职做网站挣钱么开发网站的步骤
  • 做网站接广告赚钱吗用境外服务器做网站
  • 装饰公司网站php源码东莞市建设公共交易中心网站首页
  • 道客网站建设推广福州网站开发大概费用
  • 网站后台模板如何使用海口网站建设是什么意思
  • 二学一做网站广州动漫制作公司
  • 济南建设网站wordpress企业外贸主题
  • 做加盟正规网站做cms网站步骤
  • 网站制作报价开用自己网站做邮箱域名
  • 购物网站首页模板下载做企业网站联系
  • 做网站用什么软件平面设计提升培训机构
  • 什么公司设计网站建设抖音怎么挂小程序赚钱
  • 嘉兴网站建设制作官方网站建设 找磐石网络一流
  • 绿色食品网站模板.htm爱网是什么网站