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. Dismiss Notice

Question Lighting related keywords in an Unlit graph work in editor/playmode but not in a build version

Discussion in 'Universal Render Pipeline' started by Radagasd, Jun 19, 2020.

  1. Radagasd

    Radagasd

    Joined:
    Mar 1, 2015
    Posts:
    6
    Hello,
    I'm using Unity 2019.4.0f1 with URP 7.3.1.

    I tried to implement shadow cascades in an Unlit shadergraph following this thread: https://forum.unity.com/threads/sha...uation-do-not-work-in-urp-unlit-graph.803025/

    It works in the editor and in playmode, but once I build the scene it stops working.

    Trying to find the source of the problem I found that it already breaks down at the used _MAIN_LIGHT_SHADOWS_CASCADE keyword. Below I've added three images that demonstrate the problem:
    1. The graph, which is simply white if shadow cascades are enabled and black if it is not.
    2. The scene in playmode, showing a white sphere => working as intended (as shadow cascades is on)
    3. A build version of the same scene, showing a black sphere => a different result while neither the scene nor settings have changed.

    Does anyone know how to solve/circumvent this problem?

    1: Graph
    upload_2020-6-19_12-7-11.png
    2: Editor/Playmode
    upload_2020-6-19_12-7-37.png
    3: Build version
    upload_2020-6-19_12-8-21.png
     
  2. Glader

    Glader

    Joined:
    Aug 19, 2013
    Posts:
    449
    Encountering the same issue, enabling shadow keywords on unlit shader graph shaders works in the Editor but not on standalone builds.
     
  3. Owers

    Owers

    Joined:
    Jul 7, 2012
    Posts:
    39
    Try changing the definition from 'Shader Feature' to 'Multi Compile'. Both options are essentially the same, except multi compile keywords are always included in a build, whereas shader feature keywords are only included if they are utilised by a material via the Inspector GUI (this helps reduce shader variants).

    https://docs.unity3d.com/Manual/SL-MultipleProgramVariants.html