@@ -185,7 +185,7 @@ private static bool TryConvertToBitmap(
185185 }
186186 Span < byte > outputSpan = bitmap . Bits . Slice ( i * outputSize , outputSize ) ;
187187
188- if ( ! TryDecodeTexture ( textureFormat , width , height , uncompressedSpan , outputSpan ) )
188+ if ( ! TryDecodeTexture ( textureFormat , width , height , uncompressedSpan , outputSpan , version ) )
189189 {
190190 bitmap = default ;
191191 return false ;
@@ -194,7 +194,7 @@ private static bool TryConvertToBitmap(
194194 return true ;
195195 }
196196
197- private static bool TryDecodeTexture ( TextureFormat textureFormat , int width , int height , ReadOnlySpan < byte > inputSpan , Span < byte > outputSpan )
197+ private static bool TryDecodeTexture ( TextureFormat textureFormat , int width , int height , ReadOnlySpan < byte > inputSpan , Span < byte > outputSpan , UnityVersion version )
198198 {
199199 switch ( textureFormat )
200200 {
@@ -319,8 +319,15 @@ private static bool TryDecodeTexture(TextureFormat textureFormat, int width, int
319319 return true ;
320320
321321 case TextureFormat . ARGB4444 :
322- RgbConverter . Convert < ColorARGB16 , byte , ColorBGRA32 , byte > ( inputSpan , width , height , outputSpan ) ;
323- //RgbConverter.Convert<ColorRGBA16, byte, ColorBGRA32, byte>(inputSpan, width, height, outputSpan);
322+ // I think this is right??
323+ if ( version . IsLess ( 4 , 0 , 0 ) )
324+ {
325+ RgbConverter . Convert < ColorRGBA16 , byte , ColorBGRA32 , byte > ( inputSpan , width , height , outputSpan ) ;
326+ }
327+ else
328+ {
329+ RgbConverter . Convert < ColorARGB16 , byte , ColorBGRA32 , byte > ( inputSpan , width , height , outputSpan ) ;
330+ }
324331 return true ;
325332
326333 case TextureFormat . RGBA4444 :
0 commit comments