lightmap-switching-tool
lightmap-switching-tool copied to clipboard
Mesh hash uses GetInstanceID, which changes after unity restart
In the LevelLightMapData script, it tries to find the renderer based on the hash of the transform, gameobject name and hash. In Unity 2022.3.50f1, GetHashCode() on a mesh returns the instance ID. This value does not persist properly. This means that lightmap data is not applied to any of the meshes.
We've solved this locally by removing the mesh hash altogether, as we don't see much use for it. Perhaps changing it the hash of the mesh name would be a suitable alternative?