Open MarcJamesIO opened 6 months ago
You probably rebaked in the scene where your prefab is and the script has the old index (so there is a mismatch). The script works just fine for me. Try using the bake method from the Menu again(Assets->Bake Prefab Lightmaps) again. Once its done you can check in the scripts what is saved to it to confirm (the fields in the script are public so you can inspect them)
Ok will take a look. A secondary problem is that when the prefab is rotated 180 degrees, the lightmap darkens? I've got 0 lighting in the scene (everything set to black) but when a light-mapped baked prefab rotates the textures darken anyway?
This script no longer works, unfortunately - when dynamically instantiating light-mapped prefabs using the method in the ReadMe, the incorrect lightmap is sometimes assigned to the prefab (with the incorrect lightmap index.)
The two lighter corridors are dragged from the project explorer into the scene with correct lightmaps. The two darker corridors are the same prefab and are instantiated at runtime. They have the incorrect lightmap attached to them.
The correct prefab lightmap:
The instantiated at runtime lightmap:
Unity 2022.3.9f URP