Search Issue Tracker
By Design
By Design in 2022.2.X
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
- Redoing creation of Sub Scenes and Cube GameObjects in Hierarchy throws “Assertion failed on expression: 'targetScene != nullptr’” error in Console window
- Selecting “New Sub Scene” after assigning “New Scene” in Sub Scene Script Component throws “Destroying GameObjects immediately is not permitted” in the Console window
- Shader Graph "Zoom Step Size" can be set to 0 even though the zoom still works
- Enabling/Disabling the Deprecated Nodes doesn't apply to the opened Shader Graph unless any Variable is added to the Blackboard
- Group Selection title text size is smaller in renaming than the actual font size
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.
Resolution Note (2022.2.X):
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.