Search Issue Tracker
By Design
Votes
1
Found in
2018.4
2019.3
2019.3.7f1
2020.1
2020.2
Issue ID
1233843
Regression
No
Specific Graphics.CopyTexture overload deallocates NativeArray if called after Texture.Apply
Steps to reproduce:
1. Open the attached project (case_1233843.zip)
2. Enter Play Mode
3. Ensure that no errors are present in the Console
4. Open "Test.cs", uncomment Line 14 and comment Line 15
5. Repeat Steps 2 & 3
Expected result: Texture is copied over and the NativeArray initialized via Texture2D.GetRawTextureData is not deallocated
Actual result: Texture is not copied and an InvalidOperationException is thrown
Reproduced in: 2018.4.22f1, 2019.3.13f1, 2020.1.0b8, 2020.2.0a10
Note:
- Operations have to be performed in this exact order: GetRawTextureData, Apply, CopyTexture
- If Apply is called after CopyTexture, the issue is not reproducible
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
- Errors "InvalidOperationException: Trying to use a texture (_InternalGradingLut)..." and “Render Graph Execution error” shown and Scene turns black when 16 or more Render Objects are used
- GameObjects in the Game View are rendered differently than in the Scene View when the Rendering Path is set to "Deferred" and Screen Space Shadows Renderer Feature is added
- Errors “InvalidOperationException: Trying to use a texture (_CameraDepthTexture)...” and “Render Graph Execution error” shown when selecting GameObjects with Mesh Renderer from the Hierarchy
- macOS stutters in a minimal project
- [Usability] HDRP Wizard calls for VR fixes when opening the HDRP Wizard a second time after they have already been applied and the Wizard has finished checking
Resolution Note (2020.2.X):
The native array returned by GetRawTextureData can and will get invalidated if "something" modifies the texture (and CopyTexture can be it, if the texture happens to be used at that time).