Search Unity

Can't enable Main Light Cast Shadows in scripting

Discussion in 'Editor & General Support' started by doarp, Nov 10, 2019.

  1. doarp

    doarp

    Joined:
    Sep 24, 2019
    Posts:
    147
    In the editor, when configuring the LightweightRenderPipelineAsset I can set "Lighting -> Main Light -> Cast Shadows" to Checked / Unchecked, but in scripting, the corresponding property "
    supportsMainLightShadows"
    is read-only ( has a getter without a setter). Why is that, am I missing something?

    I also can't do this when changing the pipeline asset using this code:
    Code (CSharp):
    1. GraphicsSettings.renderPipelineAsset = asset
    If the pipeline asset the game started with didn't have "Lighting -> Main Light -> Cash Shadows" checked, that switching to a different pipeline asset where it is checked doesn't enable the Main Light shadows.
    I was hoping that enabling it manually in script would help, but as it's read-only I can't do that as well.

    Edit:
    Unity: 2019.2.10f1
    LWRP: 6.9.2
     
    Last edited: Nov 10, 2019