- Home /
Lightmapped terrain in assetbundle is not showing correct in build (it is correct in editor)
Hi,
I'm trying to encapsulate a lightmapped scene (terrain + objects) into an assetbundle in order to load it into another project. Everything works fine in editor but in build the terrain is black (you can see it in the following image: left is editor, right is build).
In order to execute lightmap I used the script found there UNITY FORUM: Problems with instantiating baked prefabs. I just updated it a little bit in order to set terrain lightmapIndex and lightmapScaleOffset, and adding the following line of code into the ApplyLightmaps function.
// If you do not add this line of code before apply the lightmap to terrain and objects, the terrain is showed black and white (both editor and build)
LightmapSettings.lightmapsMode = LightmapsMode.NonDirectional;
I tried to (some of them are solution found on internet about black terrain)
add Nature/Terrain/ shaders in GraphicsSettings (Edit->Project Settings->Graphics)
Enable/Disable static batching setting in PlayerSettings
Assign custom material to terrain
Your answer
Follow this Question
Related Questions
Why is terrain so bright after lightmapping? 3 Answers
assetbuldle with lightmap 1 Answer
Lightmapping terrain WITHOUT trees 1 Answer
Lightmap corruption on terrain? 1 Answer