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
- Out-of-bounds memory access with multiple CanvasRenderers under a Canvas when using Mesh API
- Inspector tries to access file after it was deleted when the file was locked in Inspector window
- Changing Transform values in Search window Inspector loses focus while dragging and stopping mouse without releasing dragging action
- Saving changes on the dirty VFX Graph during the Play mode throws "The referenced script (Unknown) on this Behaviour is missing!" warnings
- VFX Graph Debug Info overlaps the "Initialize" block debug info by default
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.