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
- Shader warning in 'Hidden/Core/DebugOccluder' thrown after building High Definition 3D Sample Template
- Audio Mixer “+” buttons overlap with UI when the Audio Mixer window layout is set to Horizontal
- "Clear" button in the "Set project display name" closes all the pop-up instead of clearing just a name from the field
- Video Player renders no video on specific devices when using Vulkan
- The Editor slows itself down by showing tons of warnings when the majority of TransformAccessArrays content are NullRefs
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.