mirror of
https://github.com/maxartz15/MA_TextureAtlasser.git
synced 2024-11-09 15:32:55 +01:00
Fixed mesh duplication.
This commit is contained in:
parent
7f17793af0
commit
9d53f74c4b
@ -9,6 +9,7 @@ using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
@ -39,12 +40,16 @@ namespace MA_Mesh
|
||||
public static Mesh MA_DuplicateMesh(Mesh mesh)
|
||||
{
|
||||
Mesh newMesh = new Mesh();
|
||||
|
||||
newMesh.name = mesh.name;
|
||||
newMesh.SetVertices(new List<Vector3>(mesh.vertices));
|
||||
newMesh.bounds = mesh.bounds;
|
||||
newMesh.colors = mesh.colors.ToArray();
|
||||
newMesh.subMeshCount = mesh.subMeshCount;
|
||||
for (int i = 0; i < mesh.subMeshCount; i++)
|
||||
{
|
||||
newMesh.SetTriangles(mesh.GetTriangles(i), i);
|
||||
}
|
||||
newMesh.subMeshCount = mesh.subMeshCount;
|
||||
newMesh.SetNormals(new List<Vector3>(mesh.normals));
|
||||
newMesh.SetUVs(0, new List<Vector2>(mesh.uv));
|
||||
newMesh.SetTangents(new List<Vector4>(mesh.tangents));
|
||||
|
Loading…
Reference in New Issue
Block a user