Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Asset bundle workflow #25

Open
fcagnetta opened this issue Mar 17, 2020 · 5 comments
Open

Support Asset bundle workflow #25

fcagnetta opened this issue Mar 17, 2020 · 5 comments

Comments

@fcagnetta
Copy link

Hi and thanks for this tool :)
I'm experiencing an issue with light probes. I follow all the instructions, BUT, I do not build the app with the scenes inside, I make asset bundles instead and download them via the internet through the app. So, in the asset bundle, I include the "master" scene only (so, not the "day" n "night" scenes). The lightmaps are correctly included, but the LightingData assets are not.
I think here's the problem with the light probes. Do you think is there some way to link these assets in the master scene?

@laurenth-personal
Copy link
Owner

Hi, the lightprobes are saved in the lightmap data component which is in the master scene so this means it can only access the lighting scenarios you have built before you publish your master scene.

One could turn the lighting data saved in the lightmap data component into scriptable objects so that you could save them as individual assets. Then when you add more lighting scenes you could also include the lighting data scriptable object in the asset bundle.

This is something I wanted to do but it would take some time that I cannot spend right now.

@fcagnetta
Copy link
Author

Hi, the lightprobes are saved in the lightmap data component which is in the master scene so this means it can only access the lighting scenarios you have built before you publish your master scene.

So it should just work, because LevelLightmapData component is there, with its stuff inside?

One could turn the lighting data saved in the lightmap data component into scriptable objects so that you could save them as individual assets. Then when you add more lighting scenes you could also include the lighting data scriptable object in the asset bundle.

It's something that is out of my skills at the moment, but it's a good point.

This is something I wanted to do but it would take some time that I cannot spend right now.

I can understand, thank you for the work you've done so far

@laurenth-personal
Copy link
Owner

Hi, the lightprobes are saved in the lightmap data component which is in the master scene so this means it can only access the lighting scenarios you have built before you publish your master scene.

So it should just work, because LevelLightmapData component is there, with its stuff inside?

The arrays of lightprobes are in the LevelLightmapData so the ones you have built and stored before saving the scene will be there.

@laurenth-personal
Copy link
Owner

laurenth-personal commented Mar 20, 2020

Hi,
I was curious to see how long it would take to convert the data to scriptable objects so I did a quick version.
You can check out this branch :
https://github.com/laurenth-personal/lightmap-switching-tool/tree/2019.3-scriptable-object

So right now you have to create lighting scenario data assets by hand in the resources folder of the project :
right click / create / lighting / lighting scenario data
and reference them in the level lightmap data component so that when you press the store button the data goes to the scriptable object. Then you need to save so the assets get their changes saved.
The logic that stored it in the scene previously is gone so if you don't reference a lighting scenario data asset nothing happens.

The LoadLightingScenario method is now asking for a scene name string and not an index which makes it possible to load something that has been built separately (the scene can be built with say 2 lighting scenarios and you can add a 3rd one later in theory).

Right now it's not possible to use a different lightmap resolution for the various lighting scenarios because I don't load lightmap scale and offset (it's probably doable but I haven't tried yet).

In order to make this work with asset bundles one would have to change the FillDictionnary method as this one only loads whatever is in the resources folder.

@laurenth-personal laurenth-personal changed the title Light Probe not working Support Asset bundle workflow Feb 7, 2021
@laurenth-personal
Copy link
Owner

I have made some improvements to the scriptable object branch as I think this is the right way forward.
Storing the lighting data in an asset is nice as it doesn't dirty the scene, and it make it possible to use asset bundles.
The master branch is now also using scriptable objects but doesn't support the rest of the workflow as it is not fully optimized yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants