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

Mesh hash uses GetInstanceID, which changes after unity restart #43

Open
MoonmonsterBrian opened this issue Dec 4, 2024 · 2 comments
Open
Assignees
Labels

Comments

@MoonmonsterBrian
Copy link

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?

@Harrison-Chen
Copy link

Has similar problem here.
In my case, those meshes with static batching has been combine randomly, so it seems be impossible to compare with mesh hash in any way?

@laurenth-personal
Copy link
Owner

Hello,
I think you're right and the mesh name should be enough. I will change this later but in the meantime you can try version 2019.3.3 that doesn't rely on these.
@Harrison-Chen if you're using static batching you cannot set light map scale and offset at runtime. The light map uv packing needs to be the same on your different scenarios and if that's the case just switching the light maps should be enough.

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

No branches or pull requests

3 participants