Search Issue Tracker
By Design
Votes
4
Found in
2017.3.0a1
2017.4.20f2
2018.3.0a1
2019.1.0a1
2019.2.0a1
Issue ID
1129666
Regression
No
RenderTexture is flipped upside down when using "RenderTextureDescriptor"
Reproduction steps:
1. Open "1129666" project
2. Enter Play mode
3. Double Click "CustomDrawer" -> "CustomDrawer (Script)" -> "Rendertexture" -> "CustomRT"
4. Notice that the RenderTexture is flipped upside down
5. Uncomment line 25 and Comment line 24 in "CustomDrawer" script and repeat steps 2 and 3
6. Notice that the RenderTexture is not flipped
Expected Result: Uniform behavior in how RenderTexture is rendered
Actual Result: RenderTexture is flipped upside down when using "RenderTextureDescriptor"
Reproduced with: 2019.2.0a6, 2019.1.0b5, 2018.3.7f1, 2017.4.21f1
Comments (1)
-
Baggers_
May 20, 2020 11:14
Also present on both Unity versions 2020.1.0b6 & 2019.3.0f3. I did not test other versions.
Additional test case with write-up available here if helpful: https://github.com/Bouncyrock/potential-cubemap-descriptor-bug
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
- “Remove Unused Overrides” available on not loaded Scene and throws “ArgumentException: The scene is not loaded” warning
- Adaptive Probe Volume occlusion edge is calculated incorrectly when viewing probes near geometry edges
- Sampling a texture using an HLSL file throws shader errors and the code does not compile
- "Graphics.CopyTexture called with null source texture" error when Base Camera of an Overlay Camera is removed with DX11 Graphics API and Compatibility Mode enabled
- WebGL sends wrong value with large numbers when SendMessage function is used
Resolution Note:
You can avoid this behaviour by making sure that you use a constructor that takes any amount of parameters greater than 0, or by manually setting `flags |= RenderTextureCreationFlags.AllowVerticalFlip`. I would generally recommend the first solution, as that will ensure that any new properties or flags that might be added in the future have sensible default values.
The reason this happens is that C# provides a parameterless constructor for all struct types. It is not possible to remove or override this constructor. The parameterless constructor will set all values in the struct to 0, whereas the constructors we have implemented for the struct will, amongst other things, set the `RenderTextureCreationFlags.AllowVerticalFlip` on the `flags` property.