From b2ccdb2273e4524e8e189f51b4b6bf922280c93e Mon Sep 17 00:00:00 2001 From: max Date: Fri, 26 Mar 2021 11:41:19 +0100 Subject: [PATCH] Copy over all UV channels. The duplicate function now copies all 8 UV channels. So your lightmap UV's don't get lost! --- .vscode/launch.json | 54 +++++++++++++++++++ .../MA_Utilities/MeshUtils/MA_MeshUtils.cs | 7 ++- 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..5fe0a57 --- /dev/null +++ b/.vscode/launch.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/Assets/MA_ToolBox/MA_Utilities/MeshUtils/MA_MeshUtils.cs b/Assets/MA_ToolBox/MA_Utilities/MeshUtils/MA_MeshUtils.cs index 2914f41..086cd91 100644 --- a/Assets/MA_ToolBox/MA_Utilities/MeshUtils/MA_MeshUtils.cs +++ b/Assets/MA_ToolBox/MA_Utilities/MeshUtils/MA_MeshUtils.cs @@ -84,7 +84,12 @@ namespace MA_Mesh newMesh.SetTriangles(mesh.GetTriangles(i), i); } newMesh.SetNormals(new List(mesh.normals)); - newMesh.SetUVs(0, new List(mesh.uv)); + for (int i = 0; i < 8; i++) + { + List uvs = new List(); + mesh.GetUVs(i, uvs); + newMesh.SetUVs(i, uvs); + } newMesh.SetTangents(new List(mesh.tangents)); newMesh.SetColors(new List(mesh.colors));