Sprite (2D and UI)

孙广东  2015.7.8

在将图片导入Unity后 做的一些设置经常会得到警告信息。所以要了解一下这些设置。

D:\Program Files\Unity5\Editor\Data\Documentation\en\Manual\class-TextureImporter.html

Sprite (2D and UI)
选择导入到Unity中的Texture纹理。在Inspector面板上显示的要进行设置的 ImportSetting选项。
如果你的纹理将在2D游戏(或者UGUI界面)中使用作为一个Sprite,这必须选择此项。

图片:

属性:                            功能:
Sprite mode      选择sprite 图形将如何从image中提取出来。
 Single       sprite图像将被用于单独的一个【就是一张image原始图片只对应一个sprite】。之前测试了一下,如果要在Sprite Packer窗口中看到要打到执行包的所有精灵,必须是Single的。
 Multiple      多个相关精灵(例如,动画帧的连续图片或一个单一的游戏角色身上的各个组成部分)一起将保持在相同的image中【就是一张image原始图片对应多个sprite精灵】。如果选择此项,我们在得到资源后,需要 在点击”Sprite Editor“选项进行每个小精灵的提取(提取方式又有两种这里就不说了)
Packing Tag   当前纹理要被打进的图集包的名称【打包图集应该对NGUI很熟悉吧】。
Pixels To Units  在sprite图像的宽度/高度的像素数量,它将对应于世界空间中的一个距离单位。???
Pivot   图片上的一个点,在sprite的本地坐标系中(center【默认】, top-left等)。对UGUI很多时候更多是默认的center,还有就是RectTransform组件的弹窗显示,还有的时候比如要设置旋转中心点,比较特殊,我们就要Custom这个操作可以在Scene中直接调整。
Generate Mip Maps  生成Mip Maps【作用:】有个时候选择了会提示”Only POT texture can be compressed if mip-maps are enabled“ 这是因为图片必须要采用2的幂次方大小才能使用该格式。很多时候也会因为Mip Maps占用多余的内容所以不选择它
Filter Mode    选择当它获取伸展时纹理怎么样被过滤,通过转换:
 Point     纹理在近距离变成块状blocky
 Bilinear    纹理在近距离变模糊blurry 【默认选项】
 Trilinear    像Bilinear,但纹理在不同的mip级别之间也模糊了
 
 
Per-Platform Overrides:


Import Details:
Supported Formats:
Texture Sizes:
Mip Maps:


Unity5中如何减少资源的大小:

D:\Program Files\Unity5\Editor\Data\Documentation\en\Manual\ReducingFilesize.html

现在更关心我 美术的图片资源的设置,因为是2D的休闲游戏。


减小大小的第一步是确定哪些资产消耗最大,因为这些资产都是优化的重点。你可以发现这些信息从Editor Log, 在执行build后 (从Console窗口的小型面板上方菜单中选择Open Editor Log的)。

图片:

该日志提供资产类别分列的摘要,然后列出所有的个人资产消耗大小的顺序。通常情况下,像textures, music and videos的东西将会占据了大多数存储而scripts, levels and shaders往往可以忽略不计。请注意,在摘要中提到的File Headers不在自己的资产。headers实际是额外的数据被添加到“raw”资产文件来存储引用和设置。

log可以帮助您确定您可能希望删除或优化的资产,但是之前您应该考虑以下设置工作:


Unity重新编码导入的资源为其自身内部的格式,所以源资产类型的选择是不相关。例如,如果您有多层 Photoshop 纹理在项目中在building前它将夷为平地和压缩。【注意】将纹理作为 PNG 导出文件不会作出任何差异build size,所以你应该坚持的是在开发过程中对您最方便的格式。


Unity strips带从未使用的资产在build期间,所以你不用通过手动从项目中删除资产获得任何东西。唯一不会被删除的资产是脚本 (因为通常非常小) 和资产Resources文件夹中的 (由于Unity不能确定哪一种被使用哪一种没被使用)。为此,应确保这个game真的需要资源文件夹中的资产。您可能能够在Resources中资产替换为AssetBundles来动态加载的资产,从而减少player大小。

减少Build Size建议:
Textures纹理

build中纹理经常占用最多空间。首先要做是使用compressed压缩的纹理格式 (DXT(Desktop platforms) 或 PVRTC)。

试着减少的纹理大小。这里的窍门是,你不需要修改实际的源内容。只需在Project视图中选择纹理并在Import Settings中设置Max Size。它是一个好的主意来缩放对象使用的纹理,然后调整的Max Size,直到它开始看起来在场景视图中更糟。


图片:

Changing the Maximum Texture Size will not affect your texture asset, just its resolution in the game
更改纹理的Maximum大小不会影响你的纹理资产,只是更改了其在游戏里的分辨率
下表显示图像格式占用多少存储空间,以字节为单位,每个像素:
表格:

CompressionMemory consumption (bytes/pixel)
Standalone
RGB Compressed DXT10.5 bpp
RGBA Compressed DXT51 bpp
RGB 16bit2 bpp
RGB 24bit3 bpp
Alpha 8bit1 bpp
RGBA 16bit2 bpp
RGBA 32bit4 bpp
iOS
RGB Compressed PVRTC 2 bits0.25 bpp (bytes/pixel)
RGBA Compressed PVRTC 2 bits0.25 bpp
RGB Compressed PVRTC 4 bits0.5 bpp
RGBA Compressed PVRTC 4 bits0.5 bpp
RGB 16bit2 bpp
RGB 24bit3 bpp
Alpha 8bit1 bpp
RGBA 16bit2 bpp
RGBA 32bit4 bpp
Android
RGB Compressed DXT10.5 bpp (bytes/pixel)
RGBA Compressed DXT51 bpp
RGB Compressed ETC10.5 bpp
RGB Compressed PVRTC 2 bits0.25 bpp (bytes/pixel)
RGBA Compressed PVRTC 2 bits0.25 bpp
RGB Compressed PVRTC 4 bits0.5 bpp
RGBA Compressed PVRTC 4 bits0.5 bpp
RGB 16bit2 bpp
RGB 24bit3 bpp
Alpha 8bit1 bpp
RGBA 16bit2 bpp
RGBA 32bit4 bpp


总图像存储大小的公式是 = width * height * bpp。如果您正在使用 mipmap 存储将超出单个图像大约三分之一。


默认情况下Unity导入时压缩所有纹理。为了在编辑器中更快的工作流,您可以根据喜好关闭压缩,但在Build时所有纹理都压缩,无论如何设置。


【重申】Unity总是后处理导入的文件,因此,在编辑器中导入多层的PSD文件将被自动转换为JPG,在编辑器文件大小方面没有任何的区别,保存文件为源格式(例如.mb文件、 .psd文件、.tiff文件)将使得工作更加简单。










  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Shadero Sprite is a real time node-based shader tool for Unity 5, 2017 and 2018 NEW! Forum : https://forum.vetasoft.store/ Discuss with us about Shadero Sprite and more ! Description Shadero Sprite is a real time node-based shader editor. Shadero was made to be a real production time saver. Beautiful and fast, it creates many astonishing effects with the several premade and fully optimized node effects. Shadero will increase the number of the premade effects in every update. No code required. Features - Ultimate tools for 2D Shader Editor - Node based editor - Real time preview - Source code included - Load/Save project - Optimised shader - Fog Support - HDR Support - Visual selection node preview - Light Support - Blend Mode support - Normalmap with light Support - Preview directly the scene - Works with Unity UI - Many premade effects (+100) - Help Tutorial in editor - Project examples - Unity 5 and 2017 and 2018 compatible - Support Anima 2D - Support Render Texture - Support Mesh Renderer - Generate a Sprite - Create Morphing - And much much more ! http://www.shadero.com New version 1.7.0 see version history Version 1.1 - Add Node: UV > FX (UV) > Sprite Sheet Animation - Add Node: UV > FX (UV) > Pixel - Add Node: UV > FX (UV) > Fish Eye - Add Node: UV > FX (UV) > Pinch - Add Node: UV > FX (UV) > Kaleiodoscope - Add Node: Generate > Shape > XRay - Add Node: Generate > Shape > Donuts - Add Node: Generate > Shape > Lines - Add Node: Generate > Shape > Noise - Add Node: RGBA > Color > Turn Metal - Add Node: RGBA > Color > Turn Gold - Add Node: RGBA > Color > Turn Transparent - Add Node: RGBA > Color > HDR Control Value - Add Node: RGBA > Color > HDR Create - Add Force Change Parameters to the Build Shader Node (Experimental) - Add Lightning Support - Fix Node: UV > FX (UV) > Pixel XY precision - Fix new Shader Project that keep the preview material issue - Fix Auto variable order issue when you add the same node Any Feedback, error reports, questions or suggestions, please contact us at support@vetasoft.com If you like Shadero Sprite you can rate it on the asset store, it would be very helpful. Any idea or suggestions to improve Shadero Sprite? Feel free to contact us at : support@vetasoft.com

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值