Too blurry when using Gui.DrawTexture with Texture2D

I take screenshot with RenderTexture like below :

int width = (int)(Screen.width * multiplyResolution);
int height = (int)(Screen.height * multiplyResolution);

RenderTexture rt = new RenderTexture(width, height, 32);
rt.antiAliasing = 1;
rt.filterMode = FilterMode.Bilinear;
rt.wrapMode = TextureWrapMode.Clamp;

Camera.main.targetTexture = rt;
Camera.main.Render();
RenderTexture.active = rt;

Texture2D texture = new Texture2D(width, height, TextureFormat.ARGB32, false);
texture.ReadPixels(new Rect(0, 0, width, height), 0, 0);
texture.Apply();

Camera.main.targetTexture = null;
RenderTexture.active = null;
Destroy(rt);

Then i take a portion of that texture (for ex: crop everything except top left of that texture)

Texture2D result = new Texture2D((int)rect.width, (int)rect.height);
result.SetPixels(texture.GetPixels(0, 0, 200, 200));
result.Apply();

After that i use GUI.DrawTexture to draw it on screen but the quatity is bad, it’s blurry. Why is it so blurry? please help

I change from GUI.DrawTexture to Image in a Canvas Overlay but the result’s still same. If Anybody faces this prob plz help ?

Hello! I see it has been over 7 years since the original post, but running into this problem and not finding a solution has been disheartening. I do have the solution, tough. Make sure when you make a Texture2D, you set its filterMode to FilterMode.Point.

For example:

Texture2D texture = new Texture2D(64, 64);

texture.SetPixels(colorArr);
texture.Apply();

// This is what should make your textures scalable.
// You can add this before or after Apply().
texture.filterMode = FilterMode.Point;

I suppose that when you first make a Texture2D, it makes the filter mode bilinear or trilinear by default. So, change that and it should be good to go!

1 Like