Whinarn / UnityMeshSimplifier

Mesh simplification for Unity.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make MeshUtils.GetUsedUVComponents configurable

hybridherbst opened this issue · comments

Currently, UV layout is attempted to be auto-detected. This resulted in a really hard to find bug for me: I am using uv0.xyzw with z and w being data channels. On some meshes, those data channels are both 0, but the meshes still need to use 4-channel UVs so all shaders properly work (zw are undefined / sometimes 1 after only setting UV2 channels on new mesh generation).

It would be great if this default behaviour could be overriden to prevent such failures. I understand that this is a rare edge case.

I understand. The real problem here is that Unity does not (as far as I know, it could have changed in later APIs) expose any way to get the number of UV components of meshes. So the only way for me to find out without the number being explicit for every simplification was to use this automatic detection. I think it should work in most cases, but in cases such as your it wouldn't.

But you are right that there should be an option to override this behavior.

This should now be resolved with #47.