Ensure that the source Texture of the Sprite is always uncompressed. While packing Sprite Atlas, pixel data is read from the source texture and if it uses any compressed format, it may result in loss of precision as it must be uncompressed first before packing. If a Sprite is packed to a Sprite Atlas, only the Sprite Atlas Texture needs to be compressed.
一个项目可以有多个精灵图集用于不同的目的(例如,具有较低分辨率纹理的变体图集适用于具有不同限制的硬件)。如果启用所有可用的精灵图集,可能会遇到冲突(有关更多信息,请参阅解析不同的精灵图集情形)。
为防止出现这些问题,请使用以下步骤正确准备要分发的精灵图集:
Unity 默认会在项目的构建中包含精灵图集,并在运行时自动加载它们。取消选中所选精灵图集的 Include in Build 设置可以禁用此行为。
If ‘Include in Build’ is disabled, Unity still packs the Sprite Atlas into a *.spriteatlas file in the Project’s Assets folder. However, Sprites which reference Textures in a disabled Sprite Atlas appear invisible as the reference Texture is not available or loaded. Unity does not include the disabled Sprite Atlas in the Project’s published build, and does not automatically load it at run time. To do so, a script is required to load the Sprite Atlas via Late Binding.