Source Texture (file_name) of Sprite (file_name) is using compressed format. To ensure no loss in source pixel details when packing to SpriteAtlas, please use uncompressed format in TextureImporter.
스프라이트 아틀라스를 만들때 위와 같은 내용을 접하게 되었고, 이와 관련된 정보들을 수집해보았다.
https://forum.unity.com/threads/sprite-atlas-v2-in-unity-2022-1.1327704/#:~:text=%22Source%20Texture%20(image_a)%20of%20Sprite%20(image_a)%20is,Should%20that%20be%20the%20default%20approach%20now
Official - Sprite Atlas v2 in Unity 2022.1
Sprite Atlas v2 in Unity 2022.1 [ATTACH] Greetings 2D creators! We have Sprite Atlas v2 updates in Unity 2022.1 to share with you. What’s new?...
forum.unity.com
https://www.create-forever.games/unity-2022-texture-uncompressed-format-in-textureimporter/
[unity 2022]Source Texture of Sprite is using compressed format. To ensure no loss in source pixel details when packing to Sprit
[unity]テクスチャを一括変換するエディタ拡張 https://www.create-forever.games/unity-texture-changer unity にインポートしたテクスチャ(png, jpg, bmp など)は unity で使われる形式に変換され、インスペクタ
www.create-forever.games
위와 같은 정보들을 통해서 스프라이트 아틀라스를 만들때, 아틀라스 내부에 배치할 스프라이트의 경우는
유니티 인스펙터 상에서 Compression 을 none 으로 설정해주어야 하겠다.
유니티 인스펙터 상에서 Compression 부분. 이때 아틀라스에 사용하려는 sprite 의 경우는 Compression 타입을 None 으로 설정해주자
아틀라스를 만들려는 스프라이트들의 Comprssion을 모두 None 으로 바꾸고, 아틀라스로 만들어보니 에러메시지가 발생하지 않았다. 이제 위의 아틀라스를 통해서 묶여있는 스프라이트 들에 대해서 Compression을 설정해주면 된다.
스프라이트 아틀라스에서 Compression을 설정하도록 하자
++++
추가적으로 이러한 설정드렝 관해서 여러가지 파일들을 한번에, 혹은 임포트를 해올때 위와 같은 특정 방향으로 설정하게 하는데 도움이 될만한 블로그 글을 발견하였고, 이 내용을 첨부해본다.
https://www.create-forever.games/unity-texture-changer/
[unity]テクスチャを一括変換するエディタ拡張 | Unity Indies
unity にインポートしたテクスチャ(png, jpg, bmp など)は unity で使われる形式に変換され、インスペクタで属性を変更することができます。 Unity エディタで動かしてるうちは適当に設定しても
www.create-forever.games
해당 블로그의 경우 일본어로 작성되어있는데, 구글 번역기로 한글로 번역하고 어느정도 이해할만 하였으며, 해당 블로그 글에서 첨부해준 코드를 중점적으로 이해하면 좋을것이다. 현재 상황에서는 스프라이트 이미지를 많이 사용하지 않아서 위의 블로그에서 제시하는 방향으로 유니티 에디터에 스크립트를 심어서 일괄적으로 처리하지는 않지만, 그렇게 할 수 있다는것을 알아두고 그 방향이 필요하다면 사용하도록 하자.
[해당 글의 내용]
[unity] 텍스처를 일괄 변환하는 편집기 확장
unity로 가져온 텍스처(png, jpg, bmp 등)는 unity에서 사용되는 형식으로 변환되어 인스펙터에서 속성을 변경할 수 있습니다.
Unity 에디터로 움직이고 있는 동안은 적당하게 설정해도 어떻게 됩니다만, 빌드 후의 실행 체크 결과에 의해, 모든 텍스처를 특정의 스테이터스로 변경하고 싶어지는 경우가 많다고 생각합니다 .
변환 샘플
샘플에서는 2 폴더, 88 파일의 텍스처를 준비했습니다만, 실제로는 더 들어간 폴더의 곳곳에 텍스처가 들어가 있는 것입니다.
Textures 아래에있는 2 폴더,
88 파일을 함께 변환하고 싶습니다.
Filter Mode를 Point (no filter) Compression을 Normal Quality 로 각각 변경하고 싶습니다.
iOS에서만 Format을 ASTC 8x8 로 만들고 싶습니다.
이것을 인스펙터로 1 파일 마다 설정하고 있으면 힘들고, 설정을 실수할 위험성도 높아집니다. 그래서 에디터 기능으로 「선택한 폴더 아래의 텍스처를 모두 변경한다」스크립트를 작성합니다.
변환 스크립트 작성
Assets/Editor/TextureChanger.cs
public class TextureChanger : EditorWindow
[ MenuItem ( "Assets/TextureChanger" )]
foreach ( UnityEngine. Object obj in Selection. objects )
string filepath = AssetDatabase. GetAssetPath ( obj ) ;
string [] files = Directory. GetFiles ( filepath, "*" , SearchOption. AllDirectories ) ;
Directory. GetFiles ( filepath, "*" , SearchOption. AllDirectories )
Where ( path = > checkExtension ( path ) )
ForEach ( path = > textureChange ( path ) ) ;
AssetDatabase. Refresh () ;
Debug. LogError ( ex. Message ) ;
static bool checkExtension ( string path )
var ext = Path. GetExtension ( path ) . ToLower () ;
return ext == ".jpg" || ext == ".png" || ext == ".bmp" ;
static void textureChange ( string path )
Debug. Log ( $ "{path}" ) ;
var importer = AssetImporter. GetAtPath ( path ) as TextureImporter;
// Filter Mode 를 Point(no filter)
// Compression 을 Normal Quality
importer. filterMode = FilterMode. Point ;
importer. textureCompression = TextureImporterCompression. Compressed ;
// iOS 전용, Format ASTC 8x8
var settings_iOS = new TextureImporterPlatformSettings ()
format = TextureImporterFormat. ASTC_8x8 ,
importer. SetPlatformTextureSettings ( settings_iOS ) ;
AssetDatabase. ImportAsset ( path ) ;
사용법
처리할 폴더를 선택하고 마우스 오른쪽 버튼 >TextureChanger * Two Column Layout의 경우 오른쪽 열에서 폴더를 선택하십시오.
처리된 파일은 Console에 로그로 표시됩니다.
텍스처로 변경하고 싶은 내용은 textureChange() 의 47-58 행째를 적절히 써 주세요.
Assets으로 가져온 순간에 다시 쓰고 싶습니다.
일일이 TextureChanger 를 호출하는 것도 번거롭고, 모든 텍스처를 같은 값으로 하고 싶다면AssetPostprocessor.OnPreprocessTexture()사용하는 것도 개미입니다.
Assets/Editor/AssetPreprocess.cs
public class AssetPreprocess : AssetPostprocessor
public void OnPreprocessTexture ()
var importer = ( assetImporter as TextureImporter ) ;
Debug. Log ( $ "[import] texture {importer.assetPath}" ) ;
textureChange ( importer ) ;
static void textureChange ( TextureImporter importer )
// Filter Mode 를 Point(no filter)
// Compression 을 Normal Quality
importer. filterMode = FilterMode. Point ;
importer. textureCompression = TextureImporterCompression. Compressed ;
// iOS 전용, Format ASTC 8x8
var settings_iOS = new TextureImporterPlatformSettings ()
format = TextureImporterFormat. ASTC_8x8 ,
importer. SetPlatformTextureSettings ( settings_iOS ) ;
단,변경하고 싶지 않은 텍스처도 마음대로 변경될 수 있으므로, 그것을 이해한 후에 사용합시다.
일단 임포트 된 파일도, 어떠한 타이밍에 재임포트가 걸려 버리는 일이 있어, 그 때 OnProcessTexture() 로 덧쓰기되어 버립니다.