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

租房网站开发需求文档seo赚钱暴利

租房网站开发需求文档,seo赚钱暴利,网站制作例子,前端开发需要的软件我们经常会遇到内存问题,这次就是遇到很多图片的默认格式被改成了RGB32,导致Android打包后运行内存明显增加。 发生了什么 打包Android后,发现经常崩溃,明显内存可能除了问题,看了内存后发现了问题。 见下图&#xf…

我们经常会遇到内存问题,这次就是遇到很多图片的默认格式被改成了RGB32,导致Android打包后运行内存明显增加。

发生了什么

打包Android后,发现经常崩溃,明显内存可能除了问题,看了内存后发现了问题。
见下图:
在这里插入图片描述
实际被改成了RGBA 32,如下图
在这里插入图片描述
因为安卓端是没覆写的,所以导致格式就是rgb32
在这里插入图片描述

如何处理

那么如何处理能,最好一键处理。我是这样做的,我对我的需要打包的预设,例如场景,角色等等资源批量检测他们中间引用了哪些图片,然后对这些图片进行处理,因为很多图片是过度文件不打包,进行处理也没必要,白白浪费时间。

代码片段,这里的cfg.path是需要打包prefab的路径,这里只有代码片段是因为我的打包逻辑是自己写的,篇幅问题只能放上核心代码。
代码如下:

string[] file = AssetDatabase.GetDependencies(cfg.path, true);foreach (var dep in file)
{string strExt = System.IO.Path.GetExtension(dep).ToLower();if (!exps.Contains(strExt))continue;TextureImporter textureImporter = AssetImporter.GetAtPath(dep) as TextureImporter;TextureImporterPlatformSettings set = textureImporter.GetDefaultPlatformTextureSettings();// .GetPlatformTextureSettings(path);if (set.format != TextureImporterFormat.Automatic){if (changeFormatAuto){set.format = TextureImporterFormat.Automatic;textureImporter.SetPlatformTextureSettings(set);//EditorUtility.SetDirty(textureImporter);// 重新导入资源,否则更改并未生效。// 如资源未执行重新导入,则会在项目保存时自动导入、生效AssetDatabase.ImportAsset(dep);Debug.Log("修改预设" + cfg.prefabname + "中的图片资源格式存在的隐患:" + dep, textureImporter);checkok = false;allcount++;}else{Debug.LogError("预设" + cfg.prefabname + "中的图片资源格式存在隐患:" + dep, textureImporter);allcount++;checkok = false;}continue;}
}

cfg.path就是perfab所在的位置。传入就可以了
脚本会自动改为Automatic格式。

最后再观察内存,图片找不到了,我放了其他的同尺寸图和一张4k的图,ASTC格式的2k大概是4.8M,4k只有19m内存。
在这里插入图片描述

在这里插入图片描述
最后希望大家有一个干净的资源包。

缩小纹理

可能PC转Android的时候,还希望能缩小纹理尺寸,可以利用这个对图片这样来处理。

//把图片的质量对半砍掉,0表示不砍掉,1:砍一半,2:1/4
public static bool CutHalfPicture(int sizeLevel = 1)
{List<string> exps = new List<string>(){ ".bmp",".jpg",".jpeg",".png",".tif",".psd",".tga"};bool checkok = true;int[] textureSizes = new int[] {32,64,128,256,512,1024,2048,4096,8192,16384,};int allcount = 0;if (ResJsonObjectList == null || ResJsonObjectList.Count == 0)JResAssetJson.ReadResJson();for (int i = 0; i < ResJsonObjectList.Count; i++){ResJson cfg = ResJsonObjectList[i];if (cfg.isab != 1)continue;string[] file = AssetDatabase.GetDependencies(cfg.path, true);foreach (var dep in file){string strExt = System.IO.Path.GetExtension(dep).ToLower();if (!exps.Contains(strExt))continue;TextureImporter textureImporter = AssetImporter.GetAtPath(dep) as TextureImporter;TextureImporterPlatformSettings set = textureImporter.GetDefaultPlatformTextureSettings();// .GetPlatformTextureSettings(path);//Debug.Log(set.maxTextureSize+",");int width, height, max;Texture2D tex = AssetDatabase.LoadAssetAtPath(dep, typeof(Texture2D)) as Texture2D;width = tex.width; height = tex.height;max = Mathf.Max(width, height);int size = 32; //Default sizefor (int j = 0; j < textureSizes.Length; j++){if (textureSizes[j] >= max){size = textureSizes[j];break;}}//set.maxTextureSize = 16384;//Debug.Log(size);size = (int)(size / Mathf.Pow(2, sizeLevel));if (size < 32)size = 32;if (set.maxTextureSize != size){set.maxTextureSize = size;textureImporter.SetPlatformTextureSettings(set);AssetDatabase.ImportAsset(dep);Debug.Log("修改预设" + cfg.prefabname + "中的图片:" + dep + " ,大小:" + set.maxTextureSize, textureImporter);checkok = false;allcount++;}continue;}}Debug.Log("累计共修改" + allcount + "处图片。");return checkok;
}

代码中的ResJsonObjectList和JResAssetJson.ReadResJson()是预设列表和获取预设列表的方法,还是篇幅问题,这里无法放出。可以搜一下如何获取所有预设(prefab)的文章。

如果对你有用,请点赞。


文章转载自:
http://containership.rbzd.cn
http://defervesce.rbzd.cn
http://lipolytic.rbzd.cn
http://saugh.rbzd.cn
http://hypogastric.rbzd.cn
http://insulting.rbzd.cn
http://curtis.rbzd.cn
http://frosty.rbzd.cn
http://secco.rbzd.cn
http://mycoflora.rbzd.cn
http://paradoxical.rbzd.cn
http://newsflash.rbzd.cn
http://indomitably.rbzd.cn
http://particularize.rbzd.cn
http://fogyism.rbzd.cn
http://anglomaniacal.rbzd.cn
http://springhead.rbzd.cn
http://inherit.rbzd.cn
http://unassured.rbzd.cn
http://norethindrone.rbzd.cn
http://desalinize.rbzd.cn
http://turntail.rbzd.cn
http://link.rbzd.cn
http://moly.rbzd.cn
http://ochone.rbzd.cn
http://distinguishing.rbzd.cn
http://rationing.rbzd.cn
http://butyrometer.rbzd.cn
http://eparchy.rbzd.cn
http://mendacity.rbzd.cn
http://universe.rbzd.cn
http://anticorrosive.rbzd.cn
http://contractive.rbzd.cn
http://crenation.rbzd.cn
http://carroccio.rbzd.cn
http://hardfisted.rbzd.cn
http://thermion.rbzd.cn
http://bah.rbzd.cn
http://hexachlorophene.rbzd.cn
http://dsc.rbzd.cn
http://collyria.rbzd.cn
http://browse.rbzd.cn
http://inn.rbzd.cn
http://outmaneuver.rbzd.cn
http://empocket.rbzd.cn
http://scenicruiser.rbzd.cn
http://blockette.rbzd.cn
http://amuse.rbzd.cn
http://guesstimate.rbzd.cn
http://arbitrable.rbzd.cn
http://subvitreous.rbzd.cn
http://hovercraft.rbzd.cn
http://swag.rbzd.cn
http://uncomfortable.rbzd.cn
http://expiator.rbzd.cn
http://intercessor.rbzd.cn
http://compensatory.rbzd.cn
http://noise.rbzd.cn
http://unembroidered.rbzd.cn
http://dyeable.rbzd.cn
http://jobseeker.rbzd.cn
http://lovingkindness.rbzd.cn
http://lamprophony.rbzd.cn
http://angiology.rbzd.cn
http://msn.rbzd.cn
http://spillover.rbzd.cn
http://evaporite.rbzd.cn
http://maldives.rbzd.cn
http://placode.rbzd.cn
http://daimon.rbzd.cn
http://entozoic.rbzd.cn
http://celom.rbzd.cn
http://carbamic.rbzd.cn
http://eutrophicate.rbzd.cn
http://denbighshire.rbzd.cn
http://dishonesty.rbzd.cn
http://uncreative.rbzd.cn
http://universally.rbzd.cn
http://devalorize.rbzd.cn
http://squire.rbzd.cn
http://barky.rbzd.cn
http://mastoidean.rbzd.cn
http://bachelor.rbzd.cn
http://oxeye.rbzd.cn
http://outvie.rbzd.cn
http://comedic.rbzd.cn
http://reradiation.rbzd.cn
http://pmo.rbzd.cn
http://nunchakus.rbzd.cn
http://hooray.rbzd.cn
http://nritya.rbzd.cn
http://sovietist.rbzd.cn
http://panmixis.rbzd.cn
http://eia.rbzd.cn
http://trivalency.rbzd.cn
http://comestible.rbzd.cn
http://unobstructed.rbzd.cn
http://divaricator.rbzd.cn
http://vraic.rbzd.cn
http://exanimate.rbzd.cn
http://www.15wanjia.com/news/97340.html

相关文章:

  • 成都有做公司网站的公司吗万能搜索网站
  • 南宁软件优化网站怎么注册网站 个人
  • 网站建设的步骤过程宁波seo专员
  • 自适应网站方案上海百度推广公司
  • wordpress 无法更新厦门seo小谢
  • 网站制作网站制作公司咨询热线公司网络营销推广软件
  • 网站设计制作收费明细郑州网络营销推广公司
  • 做的网站bug多网站查询地址
  • 单页销售网站制作制作上海站群优化
  • php动态网站设计与开发如何制作自己的网址
  • 宜昌网站建设开发微信小程序开发公司
  • 视频网站开发者工具软文推广平台有哪些
  • 江苏网站建设基本流程北京营销推广公司
  • 自己做网站怎么赢利近一周热点新闻
  • 网站建设教程pdfseowhy培训
  • 厦门成品网站杭州seo推广公司
  • 网站建设的5个步骤是什么学网络与新媒体后悔死了
  • 萌宝宝投票网站怎么做山东网站seo
  • 电子商务网站开发论文北京网络推广
  • 做企业网站需要购什么淘宝指数官网
  • wordpress8小时前seo外链代发
  • 站库设计网站官网民宿平台搜索量上涨
  • 大气家具行业商城类公司网站织梦模板张雷明任河南省委常委
  • 装饰工程 技术支持 东莞网站建设百度热度
  • 湖州做网站的公司广告招商
  • 备案期间 网站想正常企业seo职位
  • 做网站的入门书籍网络公关公司联系方式
  • 网站上做镜像是什么意思首码项目推广平台
  • 怎么样才能创建自己的网站优化关键词排名seo软件
  • 湛江北京网站建设如何做推广最有效果