Graphics.CopyTexture not working

Hello everyone!
I’m trying to implement instant screen grabbing script for VR application and can’t overcome the problem of using new method: Graphics.CopyTexture.
Here are main code samples:

  1. Initialization:

    rt = new RenderTexture(widht, height, 24, RenderTextureFormat.ARGB32);
    tex = new Texture2D(widht, height, TextureFormat.ARGB32, false);

  2. Trying to copy texture:

    cam.targetTexture = rt;
    cam.Render();
    Graphics.CopyTexture(rt, tex);

After launching that code I got an error saying:
Graphics.CopyTexture called with mismatching mip counts (src 1 dst 9)
UnityEngine.Graphics:CopyTexture(Texture, Texture)

What am I doing wrong?
Thanks!

Hey there,
when you are grabbing from the Screen I assume you are using sth. like that:

 private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
    ...
}

I guess the texture you created has mipmaps, the one grabbed from the screen doesn’t.
Therefore try to create your Texture without mimaps. In cas of Texture2D you could try this:

screenGrabTexture = new Texture2D(Screen.width, Screen.height, TextureFormat.ARGB32, false);

with the last parameter set to false your screenGrabTexture will not generate mipmaps and should fit to the RenderTexture received in the OnRenderImage-method.

Best wishes,
Chris