Search Unity

Addressables and LightMaps

Discussion in 'Addressables' started by goldmank, Feb 25, 2020.

  1. goldmank

    goldmank

    Joined:
    Apr 11, 2018
    Posts:
    2
    Hi,

    I'm building a game where each level has its own arena and I'm baking lights for that scene so I have the scene and another folder generated by the baking process with the lighting data.
    I would like to use addressables to load that scene, the models in it and the lightmap dynamically from a remote server.
    I managed to put the models in the scene inside a prefab and marked it as addressable and loaded it up when the scene is loaded but then I lose all the baked lights, it doesn't show.

    So my question is how to load this dynamically. Do I mark the model prefab and baked lights files as addressables and then load and instantiate the prefab when the scene is loaded and then somehow apply the lightmaps?
    Or
    Do I need to mark the scene as addressable and this will include the model inside it and the baked lights and when I load the scene using addressable functions it will work?
     
  2. Patrick_PS

    Patrick_PS

    Joined:
    Sep 9, 2019
    Posts:
    154
    You could try playing around with the shader stripping options (Edit => Project Settings => Graphics => Shader Stripping). That helped me resolve a similar issue with missing lightmaps.
     
  3. goldmank

    goldmank

    Joined:
    Apr 11, 2018
    Posts:
    2
    So you say to try again option #1 with marking the model prefab as addressable and then play around with shader stripping options to try to get the baked lights to work?
     
  4. Patrick_PS

    Patrick_PS

    Joined:
    Sep 9, 2019
    Posts:
    154
    There are two things here:

    packing: creating a prefab that references all the models used in a scene and making this prefab addressable sounds very strange to me. When you mark a scene as addressable, its dependencies (including said models) will be implicitly added to the same group than the scene. I suggest marking as addressable: scenes and assets loaded from script (Addressable.LoadAsset).

    lightmap: The Asset System and the default build pipeline do not work together very well. So one of them might strip a shader or lightmap that the other needs. Here the solution is currently to tell Unity to not strip anything.