Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Assetbundle can't load the lightmap

Discussion in 'Asset Bundles' started by macepok, Apr 23, 2019.

  1. macepok

    macepok

    Joined:
    Apr 18, 2019
    Posts:
    11
    Hi, I'm built a baked scene assetbundle and put it on the server. Then, the cilent side can download the assetbundle and show the scene. When loaded the scene, the lighting is bad and i discovered the lighting data asset is not load on my scene, but the lightmap is still in here. I don't know whether there is any relationship. Anyone can help me? Thank so mush!

    I'm using Unity 2018.3.6f1

    The baked scene
    1.JPG

    The assetbundle loaded scene 2.JPG
    lighting Data asset is none
    3.JPG
     
  2. peperomero

    peperomero

    Joined:
    Mar 6, 2018
    Posts:
    2
  3. Ryanc_unity

    Ryanc_unity

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    332
    This is most likely shader variant not being compiled into the asset bundle with the correct flags for lighting. So my recommendation since you are on 2018.3 is to install and use Scriptable Build Pipeline package to build your asset bundles. Getting started: https://docs.google.com/document/d/1uuiEDV7WqpHEylzE4GQwOztCttrwPu6ak0kfELz6ilc

    An alternative is to install and use the Addressables package which makes working with asset bundles so much easier. Documentation: https://docs.unity3d.com/Packages/com.unity.addressables@0.7/manual/index.html
     
  4. ansiya

    ansiya

    Joined:
    Aug 13, 2019
    Posts:
    1
    I faced the same Issue, But solved it by changing the shader stripping options on graphic settings from automatic to custom
     
  5. Alex_Heizenrader

    Alex_Heizenrader

    Joined:
    May 16, 2019
    Posts:
    89
    Any solutions here? I don't get why the lighting data asset is not loading with a scene from an assetbundle.

    What's more, if I load the scene on its own from an assetbundle, the lightmaps are applied, but if I do additive loading then they are gone. 2019.2.9f1

    UPDATE: It was the original scene having checked auto-lighting (not the one additively loaded), once I took that off everything is fine (even the though it doesn't show the lighting data asset applied, I believe its working since even light probes work)
     
    Last edited: Apr 19, 2020
    pahe likes this.
  6. JeremyLvChy

    JeremyLvChy

    Joined:
    Jul 23, 2019
    Posts:
    10
    Any solutions here? I meet the same problem.
    Once I build all my shaders to an assetbundle (already have the "auto shader varients asset" from the "save to asset" btn on Project Setting) .All my scenes are miss light data asset .

    If I don not build all my shaders to an assetbundle ,all the scenes light data asset is correctly. but in the memory profiler,i will see more the one memroy cost from one same shader,and also more load time .

    After build all shaders ,all the other materials seem good ,and load fast,shared the only one memory cost,but only the lightmap lighting data asset is missing .
     
  7. james_wong

    james_wong

    Joined:
    Dec 12, 2020
    Posts:
    2
    I changed the Shader Stripping option, and solved this.

    Project Settings -> Graphics -> Shader Stripping

    upload_2021-5-27_10-38-50.png
     
  8. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    648
    I could use some help here. When I build my scene into an asset bundle and run it in webgl, my models turn black. From what I can tell, this is because the lighting data asset isn't loading properly. When I have Realtime GI turned off, everything is fine.

    I have the above shader stripping checkboxes checked (I tried the import button, and also all of them). I've spent a day on this so far, and nothing is yielding. However, I am noticing that if I try to add the lighting data asset to an asset bundle all by itself, the asset bundle isn't generated. Is there some bug going on that Unity will not add that files to an asset bundle??

    I am using the "BuildPipeline.BuildAssetBundles(directory, abbs, BuildAssetBundleOptions.ForceRebuildAssetBundle, _buildTarget);" command to do this. My current test is just adding a single scene into an AssetBundleBuild ... so far the models all load and it looks right on webgl (once I got my shader stuff straightened out), but the moment I bake realtime GI, the models turn black.

    Any help would be appreciated, as I can't progress until I solve this.

    Thanks.
     
    Yaom_ng likes this.
  9. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    648
    Just pinging you, since it would be great to have a very clear understanding from a dev if this _should_ work, or it shouldn't. Its as bare bones a test as I can get. A few cubes with realtime gi in 1 scene put directly into an asset bundle through BuildPipeline.BuildAssetBundles, and loading in the assetbundle then loading the scene when posted on webgl. Should realtime GI be working here?
     
    AndyRat likes this.