Search code examples
unity-game-enginegraphicsdirectxrenderingspine

Unity CopyTexture Renders 1/4 or None of sprite


I had a previously working copy texture call that has suddenly stopped working properly (for reference I am using a slightly modified version of Spine2Ds "Sprite Attacher" that copies textures to the spine). There were no code or texture format changes it just seemed to stop working one day and even the examples from Spine stopped working (I am using the latest version of Spine).

This was the code that used to work:

        Graphics.CopyTexture(source, 0, 0, (int)sourceRect.x, (int)sourceRect.y, (int)sourceRect.width, (int)sourceRect.height, destination, 0, 0, 0, 0);

Here are watch values for the above line:

enter image description here enter image description here enter image description here

The problem is it now renders copied textures as either a grey box, or, sometimes 1/4 (always the bottom left) is rendered and the other 3 quarters are rendered as grey.

For reference here is my code trying to run the copy texture code and heres how it appears

enter image description here

As you can see the bottom left is rendering but the other 3 quarters are missing. For reference I am using Spine2D and even using their example scenes whenever it does a copytexture call, those textures also appear as grey.

enter image description here

I am a novice when it comes to GPU related bugs but if you have any suggestions on how I can debug this I am all ears. I tried changing the texture formats (both original and destination) but it didn't work out well. I can't easily go back in my git history either because there are incompatible frameworks with the unity versions so I need to solve this as it is now but I can safely say there were no local code changes that caused this isssue.

Any and all suggestions on how to debug/fix this are welcome.


Solution

  • It was a spine bug and it will be fixed