Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Camera clearing issue with Render Textures when upgrading from LWRP to URP

Discussion in 'Universal Render Pipeline' started by LavaPatrik, Sep 30, 2019.

  1. LavaPatrik

    LavaPatrik

    Joined:
    Feb 21, 2017
    Posts:
    12
    I just upgraded our project from 2019.2 to the 2019.3 beta, and I've noticed an issue with a camera rendering to a render texture.

    It does not matter what "Background Type" I set (Skybox, Solid Color, Don't Care), the camera never clears before rendering.

    The only way I managed to actually get it to clear is to enable "Render Post-processing" on the camera. This results in another problem which is that this camera is created through code, and I can't figure out how to enable this camera option through my script.

    I'd love to add some screenshots, but since upgrading Unity turns completely gray when I take a screenshot of it.
     
  2. LavaPatrik

    LavaPatrik

    Joined:
    Feb 21, 2017
    Posts:
    12
    The solution was quite simple, all I had to do was this.

    Code (CSharp):
    1. var cameraData = gameObject.AddComponent<UniversalAdditionalCameraData>();
    2. cameraData.renderPostProcessing = true;
    3.