Our project needed to upgrade to 2019.3.7f1 for an SDK upgrade on a proprietary console.
This is the code we’ve been using forever (5.x until 2019.1.0f2)
public Texture2D StampPatch(Texture2D origTexture, float x1, float y1, float x2, float y2)
{
int w = (int)(x2 - x1);
int h = (int)(y2 - y1);
Texture2D tex = new Texture2D(w, h, TextureFormat.RGBA32, origTexture.mipmapCount, false);
tex.anisoLevel = 0;
tex.filterMode = FilterMode.Point;
tex.wrapModeV = TextureWrapMode.Repeat;
tex.wrapModeU = TextureWrapMode.Repeat;
tex.Apply();
Graphics.CopyTexture(origTexture, 0, 0, (int)x1, (int)y1, w, h, tex, 0, 0, 0, 0);
return tex;
}
It throws this error:
- Graphics.CopyTexture called with region not fitting in destination element (dstX 0, dstY 0, srcWidth 24, srcHeight 24, dstMip 0 → dstWidth 24, dstHeight 24)
- UnityEngine.Graphics:CopyTexture(Texture, Int32, Int32, Int32, Int32, Int32, Int32, Texture, Int32, Int32, Int32, Int32)
Any help would be greatly appreciated.