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
- "Undeclared identifier 'LinearToSRGB'" error is thrown when creating a color variable with HDR color mode and assigning a Custom Render Texture target in Shader Graph
- Input System package is missing when creating a new HDRP project
- Inconsistent behaviour when interacting with different dropdown types with pointer events on parent Visual Element
- Hidden GameObjects won't re-enable when they have call "DontDestroyOnLoad" function
- Overlay Canvas are rendered on each split-screen camera when HDR is enabled
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.