Search Issue Tracker
Feature Request
Feature Request in 2023.1.X
Votes
0
Found in
2020.3.39f1
2021.3.9f1
2022.1.16f1
2022.2.0b7
2023.1.0a9
Issue ID
UUM-13615
Regression
No
The resulting texture is empty when serializing a region copied by Graphics.CopyTexture
Reproduction steps:
1. Open the “IN-15493_CopyTexture“ project and open the “TextureCopyTest“ scene
2. Enter and exit the Play mode
3. Observe the “Assets/Textures/CopiedTextureNotWorking” texture
4. Reimport it and observe it again
Expected result: “CopiedTextureNotWorking” looks the same as “CopiedTexture“ before and after reimporting
Actual result: “CopiedTextureNotWorking” is white (empty) before and/or after reimporting
Reproduced in: 2020.3.0f1, 2020.3.39f1, 2021.3.9f1, 2022.1.16f1, 2022.2.0b7, 2023.1.0a9
Reproduced OS: Windows 11, macOS Monterey 12.0.1
Notes:
1. Copied with Graphics.CopyTexture(Texture, int, int, int, int, int, int, Texture, int, int, int, int)
2. Not reproduced with Graphics.CopyTexture(Texture, int, int, Texture, int, int)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Texture2D hash changes inside of an AssetBundle when rebuilding a SpriteAtlas bundle with an empty AssetPostprocessor Script enabled
- Aniso Level still applies when Generate MipMap is disabled in Texture Import Settings
- Mipmap Limit Groups long names are not truncated when creating a new Mipmap Limit Group with a long name
- “ArgumentException: Invalid double parameter.” error is thrown when Infinity is typed into the Fixed Timestep field
- GameObject becomes gray when using HDRP and STP together on macOS
Resolution Note:
Asset serialization can only serialize data that is available on the CPU so a CPU copy is necessary beforehand. Graphics.CopyTexture only additionally copies CPU data if both the src and dst textures are Read/Write enabled, with some additional restrictions:
In this case specifically, when the format is compressed, region-only CPU copies via Graphics.CopyTexture are not supported by Unity at this time due to complexity. This would be a feature request, not a bugfix. This can be worked around if the format is not compressed, if the entire mip is copied via the appropriate overload, or if the data is separately copied to the CPU via the alternate function GetPixels, which is meant for that purpose.
Resolution Note (2023.1.X):
Asset serialization can only serialize data that is available on the CPU so a CPU copy is necessary beforehand. Graphics.CopyTexture only additionally copies CPU data if both the src and dst textures are Read/Write enabled, with some additional restrictions:
In this case specifically, when the format is compressed, region-only CPU copies via Graphics.CopyTexture are not supported by Unity at this time due to complexity. This would be a feature request, not a bugfix. This can be worked around if the format is not compressed, if the entire mip is copied via the appropriate overload, or if the data is separately copied to the CPU via the alternate function GetPixels, which is meant for that purpose.