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

Resolved Lightmap Error

Discussion in 'Entity Component System' started by RichyHuang, Feb 23, 2023.

  1. RichyHuang

    RichyHuang

    Joined:
    Aug 24, 2020
    Posts:
    10
    I generate lighting for my subscene in Subtractive lighting mode.
    It seems normal in Editor,but all my rockes except trees turn to black in subscene mode.
    20230223-162836.jpg 20230223-162838.jpg
    While checking the Frame Debugger,I found that rockes' unity_Lightmaps is default value in subscene mode,instead the value in Editor mode.
    20230223-172824.jpg
    Note it that the rock shader uses
    #pragma multi_compile _ LIGHTMAP_ON and
    #pragma multi_compile _ MIXED_LIGHTING_SUBTRACTIVE,
    while the tree shader don't
     

    Attached Files:

    Last edited: Feb 23, 2023
  2. RichyHuang

    RichyHuang

    Joined:
    Aug 24, 2020
    Posts:
    10
    All That goes well when I Add
    [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {}
    into my shader.
    (It's all right in Editor mode,why no lightmap in subscene without the property above.-_-)
     
    Last edited: Mar 2, 2023