AssetPostProcessors 수정
This commit is contained in:
parent
f13e9e13c4
commit
4351edf318
@ -9,16 +9,13 @@ public class AssetPostProcessors : AssetPostprocessor
|
||||
private void OnPreprocessTexture()
|
||||
{
|
||||
var importer = assetImporter as TextureImporter;
|
||||
if (!importer) return;
|
||||
|
||||
var upperPath = importer.assetPath.ToUpper();
|
||||
|
||||
if (upperPath.Contains(PathConstants.RawSpritesPathUpper))
|
||||
{
|
||||
if (upperPath.Contains(PathConstants.RawOnlyAtlasPathUpper))
|
||||
{
|
||||
AssetPostprocessorSprite.OnPreprocessTextureOnlyAtlas(importer);
|
||||
}
|
||||
else if (upperPath.Contains(PathConstants.RawUiPathUpper))
|
||||
if (upperPath.Contains(PathConstants.RawUiPathUpper))
|
||||
{
|
||||
AssetPostprocessorSprite.OnPreprocessTextureForUi(importer);
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ public static class AssetPostprocessorSprite
|
||||
public static void OnPreprocessTexture(TextureImporter importer)
|
||||
{
|
||||
importer.textureType = TextureImporterType.Sprite;
|
||||
importer.spriteImportMode = SpriteImportMode.Single;
|
||||
|
||||
importer.GetSourceTextureWidthAndHeight(out var width, out var height);
|
||||
importer.spritePixelsPerUnit = width <= height ? width : height;
|
||||
@ -25,7 +24,6 @@ public static void OnPreprocessTexture(TextureImporter importer)
|
||||
importer.isReadable = true;
|
||||
importer.mipmapEnabled = false;
|
||||
importer.streamingMipmaps = false;
|
||||
importer.wrapMode = TextureWrapMode.Clamp;
|
||||
importer.filterMode = FilterMode.Bilinear;
|
||||
|
||||
importer.textureCompression = TextureImporterCompression.Uncompressed;
|
||||
@ -44,16 +42,11 @@ public static void OnPreprocessTexture(TextureImporter importer)
|
||||
public static void OnPreprocessTextureForUi(TextureImporter importer)
|
||||
{
|
||||
importer.textureType = TextureImporterType.Sprite;
|
||||
importer.spriteImportMode = SpriteImportMode.Single;
|
||||
|
||||
// 기본 PPU (UI는 100 또는 1 고정 추천)
|
||||
importer.spritePixelsPerUnit = 100f;
|
||||
|
||||
importer.sRGBTexture = true;
|
||||
importer.isReadable = false;
|
||||
importer.mipmapEnabled = false;
|
||||
importer.streamingMipmaps = false;
|
||||
importer.wrapMode = TextureWrapMode.Clamp;
|
||||
importer.filterMode = FilterMode.Bilinear;
|
||||
|
||||
importer.textureCompression = TextureImporterCompression.Uncompressed;
|
||||
@ -68,17 +61,6 @@ public static void OnPreprocessTextureForUi(TextureImporter importer)
|
||||
|
||||
importer.SetTextureSettings(textureSettings);
|
||||
}
|
||||
|
||||
public static void OnPreprocessTextureOnlyAtlas(TextureImporter importer)
|
||||
{
|
||||
if (importer.textureType == TextureImporterType.Sprite)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
importer.textureType = TextureImporterType.Sprite;
|
||||
importer.spriteImportMode = SpriteImportMode.Single;
|
||||
}
|
||||
|
||||
private static void TryApplyPivotAfterImport(string path)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user