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 letter "i" is incorrectly formatted into “İ" when capitalised if the devices Region is set to "Turkish (Turkiye)"
- [VFX] "ArgumentException" error thrown when trying to add/create Curl Noise Node
- Properties of custom visual elements fail to initialize when inside of template that has been renamed
- HDR output fails to render in Player when using Direct3D11 in Exclusive Fullscreen mode
- Crash on block_merge_next when moving a GameObject with a specific Particle System Component and Rate Over Distance is set to above 0 in the Emission tab
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.