Unity 优化心得 (2D游戏)
来源:互联网 发布:windows vista 64位 编辑:程序博客网 时间:2024/06/05 08:44
Unity(261)2D(40)
误区1:性能优化只是程序员的责任,与美术和策划无关。
-技术美术和关卡设计师对于游戏性能承担着非常重要的责任
-程序员往往无法补救由于滥用美术资源而造成的性能问题
误区2:在制定了严格的美术规范之后,美术师就应该对一切美术问题负责,程序员不再与此有关
-程序员应该为美术师实现完整的美术资源合法性检查工具
-Tools speak louder than rules!
误区3:对于程序而言,性能优化应该从GPU/Shader的执行效率入手
-针对CPU端/游戏逻辑的性能优化往往能够取得更大的作用
-GPU/Shader的性能优化应该放在最后进行
原文链接:http://cl314413.blog.163.com/blog/static/190507976201292453413286/
这里推荐使用一个优化工具BulidReqort
上面会显示很详细的资源所占大小
下面说说对于一些资源的优化
图片:
JPG图片
一般采用自动压缩要是大小还不满足要求那么就把纹理max size 设置小一些;
png图片:
一般不是要求特别高清的可以使用rgba 16这个完全满足要求 比rgba32小一般 内存开销也是小一半的
音乐:
音乐一般采用修改采样率的办法来压缩 修改采样率为128就够了
然后作为 2d游戏吧所有音乐都改为单声道小一半
模型的话一半都是图片比较大把图片按照上面的改下就好
场景参考这个可能能小一些http://www.xuanyusong.com/archives/1919
最后附上一个修改unity导入后图片格式的代码
using UnityEngine;
using System.Collections;
using UnityEditor;
public class SetAssetPostprocessor : AssetPostprocessor
{
void OnPostprocessTexture(Texture2D texture)
{
string path = assetPath.ToLower();
if
(path ==
null
||path ==
""
)
{
return
;
}
TextureImporter textureImporter = AssetImporter.GetAtPath(path) as TextureImporter;
if
(textureImporter ==
null
)
{
return
;
}
textureImporter.textureType = TextureImporterType.Advanced;
textureImporter.isReadable =
true
;
textureImporter.mipmapEnabled =
false
;
if
(path.EndsWith(
".jpg"
))
{
textureImporter.npotScale = TextureImporterNPOTScale.ToNearest;
textureImporter.maxTextureSize = 2048;
textureImporter.textureFormat = TextureImporterFormat.AutomaticCompressed;
}
else
{
textureImporter.maxTextureSize = 2048;
textureImporter.npotScale = TextureImporterNPOTScale.ToNearest;
textureImporter.textureFormat = TextureImporterFormat.RGBA16;
}
AssetDatabase.Refresh();
}
}
0 0
- unity 优化心得 (2D游戏)
- Unity 优化心得 (2D游戏)
- unity制作2d游戏(捕鱼达人)优化
- 2D(横版)游戏开发心得
- Spine+Unity(2D游戏)
- Unity 2D游戏制作
- [unity]unity 2d draw call优化
- Unity 2D游戏开发快速入门(内部资料)
- unity初写游戏(一)2D界面GUIText
- Unity 3D优化游戏运行性能的经验
- Unity 3D优化游戏运行性能的经验
- [Unity 3D] Unity 3D 性能优化(二)
- [Unity 3D] Unity 3D 性能优化(三)
- [Unity 3D] Unity 3D 性能优化(二)
- [Unity 3D] Unity 3D 性能优化(三)
- [Unity]2D打飞机游戏
- Unity - 2D游戏中掉帧严重问题解决
- Unity 2D游戏相机跟随
- Eclipse中servlet显示无法导入javax.servlet包
- 百度地图定位
- 使用VS2012内建的C++测试架构进行单元测试
- ruby笔记(2)
- Java 日期字符串date与数字long之间的转换
- Unity 优化心得 (2D游戏)
- 10个Android开源个性化View控件
- Term weight algorithm in IR
- 【jzoj4685】【礼物】
- 使用表单标签,与用户交互
- 规范相交
- poj 3056 The Bavarian Beer Party (区间DP)
- VS2010/MFC编程入门之十三(对话框:属性页对话框及相关类的介绍)
- 不只是给面试加分 -- Java WeakReference的理解与使用