UnityTextureOps
UnityTextureOps copied to clipboard
Texture is not loading properly while passing the format
public Texture2D tex;
var tex1 = TextureOps.Scale(tex, tex.width / 2, tex.height / 2, tex.format); yield return null; originalImage.sprite = Sprite.Create(tex1, new Rect(0, 0, tex1.width, tex1.height), new Vector2(0.5f, 0.5f), 100f, 0, SpriteMeshType.FullRect);
I tried to scale down the texture by using the above method and tried to apply to a image. But It always show some lines instead of original one
Image used
converted Image
Error : Unable to retrieve image reference UnityEngine.Texture2D:ReadPixels (UnityEngine.Rect,int,int,bool) TextureOps:Scale (UnityEngine.Texture,int,int,UnityEngine.TextureFormat,TextureOps/Options) (at ./Library/PackageCache/com.yasirkula.textureops@66623dae8d/Plugins/TextureOps/TextureOps.cs:467) ImageConvert/<Start>d__6:MoveNext () (at Assets/ImageConvert.cs:35) UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)
Import settings
Unity 2022.3.7
Adding aspect ratio fill/scale will also a good option for this asset!
I'd like to know if this is Compression related. Can you set it to None for testing purposes?
PS. Does TextureOps.ScaleFill satisfy the aspect ratio fill/scale you've mentioned?
If I didn't pass the format, it is working good
Haven't tested the fill API