ryanslikesocool / Mecanim2Texture

Bake skinned mesh animations to 2D textures
MIT License
53 stars 7 forks source link

Writing UVS Doesn't work #3

Closed transcendtient closed 3 years ago

transcendtient commented 3 years ago

Line 690 MecanimToTexture

List<Vector2> resultUV = new List<Vector2>(); mesh.GetUVs((int)uvLayer, resultUV); ... for (int i = 0; i < resultUV.Count; i++)

resultUV.Count will always be 0 for uninitialized UVs. E.G. writing to a new UV channel will be unsuccessful always.

Since UV0 is the default channel for most applications I hardcoded this: List<Vector2> resultUV = new List<Vector2>(); mesh.GetUVs(0, resultUV);

ryanslikesocool commented 3 years ago

Thanks! I've pushed a fix on the dev branch, with an extra failsafe just in case every UV channel is empty. I'll be merging it into the main branch sometime in the near future with your other request ( #2 )