Copy over all UV channels.

The duplicate function now copies all 8 UV channels. So your lightmap UV's don't get lost!
This commit is contained in:
max 2021-03-26 11:41:19 +01:00
parent df16ba6c05
commit b2ccdb2273
2 changed files with 60 additions and 1 deletions

54
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,54 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Unity Editor",
"type": "unity",
"path": "/D:/PerforceMax/Projects/Unity/MA_TextureAtlasser/Library/EditorInstance.json",
"request": "launch"
},
{
"name": "Windows Player",
"type": "unity",
"request": "launch"
},
{
"name": "OSX Player",
"type": "unity",
"request": "launch"
},
{
"name": "Linux Player",
"type": "unity",
"request": "launch"
},
{
"name": "iOS Player",
"type": "unity",
"request": "launch"
},
{
"name": "Android Player",
"type": "unity",
"request": "launch"
},
{
"name": "Xbox One Player",
"type": "unity",
"request": "launch"
},
{
"name": "PS4 Player",
"type": "unity",
"request": "launch"
},
{
"name": "SwitchPlayer",
"type": "unity",
"request": "launch"
}
]
}

View File

@ -84,7 +84,12 @@ namespace MA_Mesh
newMesh.SetTriangles(mesh.GetTriangles(i), i);
}
newMesh.SetNormals(new List<Vector3>(mesh.normals));
newMesh.SetUVs(0, new List<Vector2>(mesh.uv));
for (int i = 0; i < 8; i++)
{
List<Vector2> uvs = new List<Vector2>();
mesh.GetUVs(i, uvs);
newMesh.SetUVs(i, uvs);
}
newMesh.SetTangents(new List<Vector4>(mesh.tangents));
newMesh.SetColors(new List<Color>(mesh.colors));