- Home /
Graphics.CopyTexture not working?
Hello, I need to combine multiple depth textures into one atlas. I'm trying to achieve that using Graphics.CopyTexture. It's not working for me, so I decided to simplify my code and here are my results:
When I'm using Graphics.CopyTexture(_depthCamera.DepthTexture, _depthCombinedTexture); It works fine, but obviously it's useless in my case
When I'm trying to make a copy using: Graphics.CopyTexture(_depthCamera.DepthTexture, 0, 0, 0, 0, _depthCamera.DepthTexture.width, _depthCamera.DepthTexture.height, _depthCombinedTexture, 0, 0, 0, 0); it has to do the same, but it does nothing. Textures are the same (the same size too).
I've checked SystemInfo.copyTextureSupport for my hardware - all options are available. What am I doing wrong or should I use any other option to combine textures?
I've never used the CopyTexture method, but you could always swap the pixels.
Color[] colors = myTexture.GetPixels();
myOtherTexture.SetPixels(colors);
I didn't mention - it's for RenderTexture, so unfortunately GetPixels/SetPixels is not an option.
What's your target platform and Texture type(s)? CopyTexture seem to have additional restrictions based on the format as you can read in the documentation
What exactly is "_depthCombinedTexture"? I guess it's also a RenderTexture? Does it have the RenderTextureFormat "Depth"?
I barely used RenderTextures so i can't say much about it's limitations ^^. Just to be sure: You said you checked SystemInfo.copyTextureSupport. What numerical value does it have? "31" / "0x1F" or something else?
$$anonymous$$y target platform is PC. _depthCombinedTexture is also a RenderTexture with the same format as _depthCamera.DepthTexture - both are depth textures. And just for testing I've also made them the same size (256x256).
And copyTextureSupport == 31
Wow, i think that's the first time someone answers all my counter-questions in one go. $$anonymous$$ost seem to only read the first or the last question ^^. Unfortunately that means we ruled out most potential issues and i have no idea what else might be the problem. $$anonymous$$y only other guess would be that the method might expect some odd parameter "ranges" for srcElement, src$$anonymous$$ip, dstElement, dst$$anonymous$$ip, though it's unlikely. $$anonymous$$aybe the method has trouble to apply those parameters to textures that don't have multiple layers / slices or mip levels.
I guess your best option is to contact the support. Either via the contact page or by filing a bug report with a repro-case. The bug-report is most likely the better option. If you have the time you could setup a seperate project that reproduces the problem and write a detailed description of the problem. Bug reports usually get the most attention and they are easier for the support to verify / check. Bug reports also contain your hardware and OS specs which makes it easier to find edge-case problems.
ps: Have you tried creating a build of your application? Sometimes there are strange limitations inside the editor but i doubt this is the case here.
Your answer
![](https://koobas.hobune.stream/wayback/20220612111445im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Graphics.CopyTexture not working 1 Answer
Alternative for Graphics.CopyTexture() ? 2 Answers
Best way to convert particles and sprites in a single sprite at runTime 1 Answer
ReadPixels returns RGBA(0,0,0,0) 0 Answers
Texture missing data 1 Answer