Search Issue Tracker
By Design
Votes
0
Found in [Package]
9.0.0-preview.33
Issue ID
1259997
Regression
No
[HDRP] RenderTextures used as light cookie stop working in build
Reproduction steps:
1. Open attached project "LightCookie.zip" and scene "Directional RT Cookies"
2. Enter Play Mode
3. In Game View, observe "Plane", "Cube" and "Cube (debug)" GameObject
4. Exit Play Mode
5. Build and play project
6. In Build, observe "Plane", "Cube" and "Cube (debug)" GameObject
Expected result: Render texture cookie works the same as in Editor
Actual result: Render texture cookie constantly switches between two states
Reproducible with: 2019.4.7f1 (HDRP 7.4.1), 2020.1.1f1, 2020.2.0a20 (HDRP 9.0.0-preview.33)
Could not test with: 2018.4.26f1 (errors break project)
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:
The issue is in fact caused by a missing call to IncrementUpdateCount() on the render texture.
For performance reasons, cookie texture atlas isn't updated every frame for every textures (as most of them are static anyway). To tell the system that the content of a texture has changed, you need to call IncrementUpdateCount() on the render texture, the system can then check the updateCount property to see if it has changed.
However there is several things to note:
- A mistake in the code made the atlas wrongly update in the editor. We will fix this so that behavior stays consistent between build/editor.
- The documentation does not mention the need for IncrementUpdateCount so we will add a section to the light documentation to highlight that.
Additional note on the repro scene.
The script was creating a new RenderTexture each frame which is wrong because it will flood the atlas with a new texture every frame. I assume that this was some left overs from debugging tests but this should be removed for a correct behavior.