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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution 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.