Search Issue Tracker
Won't Fix
Votes
0
Found in
2021.3.11f1
2022.2.0b8
2023.1.0a10
Issue ID
UUM-16502
Regression
No
Camera view capture is black when adding Texture2D.ReadPixel before Camera.Render
Steps to reproduce:
1. Go to %userprofile% → AppData → LocalLow → enaielei → Unity Frameworks
2. Create a “states” folder
3. Open the “IN-15158_test” project
4. Open the “Test” Scene (Assets → Game → Scenes)
5. Enter Play mode
6. Press the “Test” button to capture and save the png
7. Open the saved picture in the “states” folder
Expected result: The picture shows the Game view
Actual result: The picture is black
Reproducible with: 2021.3.11f1, 2022.2.0b8, 2023.1.0a10
Could not test with: 2020.3.40f1 (Project does not open), 2022.1.18f1 (Console errors)
Reproduced on: Windows 10
Workaround_1:
– First 5 steps are the same
6. Go to the Main Camera then set the Camera's output texture to the RenderTexture in "Assets/Game/RenderTextures" folder
7. Remove the referenced RenderTexture/Undo the operation
8. Press the Test button to capture and save the png
Woraround_2: Add a Camera.Render before Texture2D.ReadPixel
Note: Also reproducible in the Player
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
- [Android] [iOS] [UnityWebRequest] Requests with "UnityWebRequest" are open for SSL Proxying
- SetWindowsHookEx does not prevent Windows key input when Editor or Player Window is focused and Active Input Handling is set to “Input System Package (New)” or “Both”
- Crash on GetEffectiveBc7TextureCompressor() when loading and unloading all Assets in the Project
- Terrain Masks do not ignore the mipmap limit
- "Build And Run" the project for Web is allowed even though the directory for the non-default browser is not selected
Resolution Note:
This seems to be how it is supposed to work. The work around described by the user "Add a Camera.Render before Texture2D.ReadPixel" is what should be done. Without the camera.render the rendertexture contents are not guaranteed and may contain old data or cleared data (black).