| | 1 | | using UnityEditor; |
| | 2 | | using UnityEngine; |
| | 3 | |
|
| | 4 | | namespace MainScripts.DCL.AssetsEmbedment.Editor |
| | 5 | | { |
| | 6 | | public class EmbeddedTextureProcessor : AssetPostprocessor |
| | 7 | | { |
| | 8 | | private static string texturesPathCached; |
| | 9 | |
|
| 0 | 10 | | private static string texturesPath = |
| | 11 | | texturesPathCached ??= TextureEmbedder.texturesPath.StartsWith(Application.dataPath) |
| | 12 | | ? TextureEmbedder.texturesPath.Remove(0, Application.dataPath.Length) |
| | 13 | | : TextureEmbedder.texturesPath; |
| | 14 | |
|
| | 15 | | private void OnPreprocessTexture() |
| | 16 | | { |
| 0 | 17 | | if (assetPath.Contains(texturesPath)) |
| | 18 | | { |
| 0 | 19 | | var texImporter = (TextureImporter)assetImporter; |
| 0 | 20 | | texImporter.isReadable = true; |
| 0 | 21 | | texImporter.alphaIsTransparency = true; |
| 0 | 22 | | texImporter.mipmapEnabled = false; |
| | 23 | | } |
| 0 | 24 | | } |
| | 25 | | } |
| | 26 | | } |