Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

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

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

  1. Marvell_S

    Marvell_S

    Joined:
    Mar 1, 2015
    Posts:
    3
    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:
    423
    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
     
unityunity