Ayfel / PrefabLightmapping

Script for saving lightmapping data to prefabs. Used through the Assets tab in Unity. Place your prefbas in the scene with this script at the root. Set up your lighting and in the editor go to Assets->Bake Prefab Lightmaps. After is processed you can now spawn your prefabs in different scenes and they will use the lightmapping from the original scene.
645 stars 90 forks source link

Lightmap changes when scene is changed. #7

Closed Nuklettin closed 4 years ago

Nuklettin commented 4 years ago

Hello, im a beginner trying to make a procedural driving game. My road is being made at runtime so i needed your script for saving my lightning data. So i did; 1)Put my road prefabs on a scene with a baked light(streetlamp) 2)Baked prefab lightmaps from Assets/Bake Prefab Lightmaps 3)Built the game on android platform, with Baking scene first, playing scene second. When i run the game on play mode, everything is fine. My baked data transfers to the second scene and there is no problem. But on android build it breaks.

This is the first scene where i baked the data, the normal lightmap should be like this so it is baked fine. When the button is pressed, i proceed to the second scene where the game is played.

And this is the second scene where the magic happens. The textures are partly black, partly lit.

I have post processing on the playing scene so i thought maybe it is the reason, but when i deactivated it nothing changes, still black textures. Been trying to fix this for almost a week. Any help would be amazing, thanks.

Ayfel commented 4 years ago

Check the repo readme in case the issue is that no shaders are being included in the build due to shader stripping. That's most likely the case from what I gather

Nuklettin commented 4 years ago

I have tried it, on automatic, custom (tried import from this scene and tried other varieties) and nothing changed, not even a bit.

Ayfel commented 4 years ago

Can you send me a repo case? Basically a scene with it so I can test it. Also what version of Unity are you on?

Nuklettin commented 4 years ago

Really sorry for the late answer, after you asked for a case, i decided to make a mini project to send, then i found the solution which is irrelevant to your code. It works like a charm, thanks