protected override void OnUpdate() { Entities.ForEach((UnityEngine.Texture2D texture) => { var writer = TryCreateAssetExportWriter(texture); if (writer != null) { var parameters = GetTextureCompressionParams(texture); switch (parameters.FormatType) { case TextureFormatType.WebP: default: Texture2DExportUtils.EncodeWebP(writer, texture, parameters.Lossless, parameters.CompressionQuality); break; case TextureFormatType.PNG: Texture2DExportUtils.ExportPng(writer, texture); break; } } else { throw new Exception($"Failed to retrieve FileInfo for texture: {texture.name}"); } }); }
protected override void OnUpdate() { Entities.ForEach((UnityEngine.Texture2D texture) => { using (var writer = TryCreateAssetExportWriter(texture)) { if (writer != null) { Texture2DExportUtils.ExportPng(writer, texture); } } }); }