Search Issue Tracker
By Design
Votes
0
Found in
2022.2.0b3
Issue ID
UUM-2740
Regression
No
Blit to Backbuffer fails when switching camera.targetTexture mid-frame
Reproduction steps:
1. Open attached Project
2. Press Play
3. Press Blit To Back
4. Build and Run
5. Press Blit to Back
Expected result: The Behaviour is the same
Actual result: The Editor fails to Render, while the Player successfully Renders
Reproducible with: 2020.3.14f1, 2021.1.16f1, 2021.2.0b4, 2022.1.0a3
Could not test with: 2019.4 (Compiler errors)
Notes:
DirectX or Vulkan fail to render in both the Player and Editor
OpenGL works in the Player
Rendering works if the Scene starts with Blit To Back, instead of Switching to Blit To Back after being started (This can be changed on the Script on the Main Camera)
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
- The Scrollbar becomes unusable when adding Elements to the List
- "One or more data file missing for baking set NewScene Baking Set. Cannot load shared data." error in Player when a specific project is built
- Choosing new HDR Colour using RGB values breaks colour on Intensity Selectors
- Rendering/Decal Layer Mask options are different inside Prefab Mode and outside Prefab Mode when the project is upgraded to Unity 6
- Incorrect Realtime GI Light Probes baking when more than one Light Probe Group is used and "Baked Global Illumination" is enabled
Resolution Note:
This seems to be user error
private void OnPostRender()
{
m_camera.targetTexture = null;
switch (Test)
{
case TestType.BlitToBackBuffer:
Graphics.Blit(m_RT, dest: null);
m_camera.targetTexture = m_RT;
break;
}
}
This code leads to the camera always having the target texture set to m_RT except for a very brief function between the start of OnPostRender and the m_camera.targetTexture = m_RT;
This can be validated by for example logging targetTexture in the onupdate
Debug.LogError("Target tex: " + ((m_camera.targetTexture == null) ? "null" : m_camera.targetTexture.name)); logs null first then RT when "Blit to Back" is pressed.
The editor correctly informs the user that there are no active cameras rendering to the screen.