Sprite (2D and UI)

Source: Internet
Author: User
Tags documentation

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced. From the game development lab-Sun Guangdong

Sun Guangdong 2015.7.8

Some of the settings you make when you import a picture into unity often get a warning message. So check out these settings.

D:\Program files\unity5\editor\data\documentation\en\manual\class-textureimporter.html

Sprite (2D and UI)
Select the texture texture to import into unity. The importsetting option that is displayed on the Inspector panel to be set.
If your texture will be used as a sprite in a 2D game (or Ugui interface), this must be selected.

Image:

Properties: Features:
Sprite Mode Select how the Sprite shape will be extracted from the image.
The single sprite image will be used for a separate "just one image of the original image corresponding to a sprite." Before testing, if you want to see all the sprites in the Sprite Packer window that you want to hit to execute the package, you must be single.
Multiple multiple related sprites (for example, a continuous picture of an animated frame or various components of a single game character) will remain in the same image as "just one image of the original image corresponding to multiple sprite sprites." If you choose this, we need to click on the "Sprite Editor" option to extract each sprite when we get the resources (there are two different ways to extract this)
Packing Tag The name of the Atlas package to which the current texture is to be punched "package Atlas should be familiar to Ngui".
Pixels to Units the number of pixels in the width/height of the sprite image, which corresponds to a distance unit in world space ....
A point on the Pivot picture, in the local coordinate system of the sprite (center "default", Top-left, etc.). For Ugui many times more is the default center, there is the Recttransform component of the pop-up window display, there are times such as to set the rotation center point, more special, we will be custom this operation can be directly adjusted in the scene.
Generate MIP maps Generate MIP Maps "Action:" There is a time when you choose to prompt "only POT texture can be compressed if Mip-maps is enabled" This is because the picture must be 2 power to large Small to use this format. Most of the time, the MIP maps occupy extra content, so you don't choose it.
Filter Mode Selects how the texture is filtered when it gets stretched, by converting:
Point texture becomes blocky blocky at close range
Bilinear texture in close range blur blurry "default options"
Trilinear are like bilinear, but textures blur between different mip levels.


Per-platform Overrides:


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


How to reduce the size of resources in Unity5:

D:\Program files\unity5\editor\data\documentation\en\manual\reducingfilesize.html

Now more concerned about my art picture resource settings, because it is a 2D casual game.


The first step in reducing the size is to determine which assets are consumed the most, because these assets are the focus of optimization. You can find this information from editor log, after the build is executed (choose Open Editor Log from the top menu in the console window).

Image:

The log provides a summary of the asset classes, and then lists the order of all personal asset consumption sizes. Typically, things like textures, music and videos will occupy most of the storage and scripts, levels and shaders are often negligible. Note that the file headers mentioned in the summary is not in its own assets. Headers is actually additional data that is added to the "raw" asset file to store references and settings.

Log can help you identify assets that you might want to delete or optimize, but you should consider the following setup work before:


Unity re-encodes the imported resource into its own internal format, so the selection of the source asset type is irrelevant. For example, if you have a multilayer Photoshop texture in the project before building it will be flattened and compressed. "Note" The texture as a PNG export file will not make any difference to build size, so you should stick to the format that is most convenient for you during the development process.


Unity strips has never used assets during build, so you don't have to get anything by manually deleting assets from the project. The only assets that will not be deleted are the scripts (because they are usually very small) and the Assets Resources folder (because unity cannot determine which one is being used and which one is not used). To do this, make sure that the game really requires assets in the resource folder. You may be able to replace assets in resources with Assetbundles to dynamically load assets, thereby reducing the player size.

Reduce Build Size Recommendations:
Textures Texture

Textures in build often occupy the most space. The first thing to do is to use the compressed compressed texture format (DXT (Desktop platforms) or PVRTC).

Try to reduce the texture size. The trick here is that you don't need to modify the actual source content. Simply select the texture in Project view and set the Max Size in import settings. It is a good idea to scale the object using the texture and then adjust the max Size until it starts to look worse in the scene view.


Image:

Changing the Maximum Texture Size would not affect your Texture asset, just it resolution in the game
Changing the maximum size of a texture doesn't affect your texture assets, it just changes its resolution in the game
The following table shows how much storage space is consumed in the image format, in bytes, per pixel:
Form:

Compression Memory consumption (bytes/pixel)
Standalone
RGB Compressed DXT1 0.5 BPP
RGBA Compressed DXT5 1 BPP
RGB 16bit 2 BPP
RGB 24bit 3 BPP
Alpha 8bit 1 BPP
RGBA 16bit 2 BPP
RGBA 32bit 4 BPP
Ios
RGB Compressed PVRTC 2 bits 0.25 BPP (Bytes/pixel)
RGBA Compressed PVRTC 2 bits 0.25 BPP
RGB compressed PVRTC 4 bits 0.5 BPP
RGBA compressed PVRTC 4 bits 0.5 BPP
RGB 16bit 2 BPP
RGB 24bit 3 BPP
Alpha 8bit 1 BPP
RGBA 16bit 2 BPP
RGBA 32bit 4 BPP
Android
RGB Compressed DXT1 0.5 BPP (Bytes/pixel)
RGBA Compressed DXT5 1 BPP
RGB Compressed ETC1 0.5 BPP
RGB Compressed PVRTC 2 bits 0.25 BPP (Bytes/pixel)
RGBA Compressed PVRTC 2 bits 0.25 BPP
RGB compressed PVRTC 4 bits 0.5 BPP
RGBA compressed PVRTC 4 bits 0.5 BPP
RGB 16bit 2 BPP
RGB 24bit 3 BPP
Alpha 8bit 1 BPP
RGBA 16bit 2 BPP
RGBA 32bit 4 BPP


The total image storage size formula is = width * Height * bpp. If you are using mipmap storage, you will exceed a single image by approximately one-third.


By default, all textures are compacted when unity imports. For faster workflows in the editor, you can turn off compression as you like, but all textures are compressed at build, anyway.


"Reiterate" unity always post-processing the imported files, therefore, importing multi-layered PSD files in the editor will be automatically converted to JPG, there is no difference in the size of the editor file, saving the file as a source format (such as. mb files,. psd files,. tiff files) will make the job easier.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.