Version: 2023.2
言語: 日本語
スプライトアトラスワークフロー
配布の方法

配布用スプライトアトラスの準備

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.

プロジェクトは、さまざまな目的 (例えば、さまざまな制限を持つハードウェアのための 低解像度 テクスチャを持つ バリアントアトラス) のために複数のスプライトアトラスを持つことができます。使用可能なすべてのスプライトアトラスを有効にすると、不具合が発生する可能性があります (詳細は、さまざまなスプライトアトラスのシナリオの解決 を参照)。

これらの問題を回避するには、スプライトアトラスを配布用に適切に準備します。手順は以下の通りです。

  1. スプライトアトラスのプロパティの ‘Include in Build’ を無効にします
  2. アトラスを配布する 方法 を選択してアトラスを配布します。
  3. スクリプトを使った 遅延バインディング (Late Binding) でアトラスを読み込みます。

‘Include in Build’ を無効にする

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.

スプライトアトラスワークフロー
配布の方法