static void SaveMesh(IProceduralMesh aMesh)
        {
            aMesh.Build(true);
            Mesh m = aMesh.MeshData;

            string name = "";
            string file = "";

            GetUniquePath((aMesh as Component).gameObject, m.name, out name, out file);

            try {
                UnityEditor.AssetDatabase.CreateAsset(m, file);
                UnityEditor.AssetDatabase.Refresh(       );
            } catch {
                Debug.LogError("Unable to save prefab procedural mesh! Likely, you deleted the mesh files, and the prefab is still referencing them. Restarting your Unity editor should solve this minor issue.");
            }
        }
Esempio n. 2
0
        static void SaveMesh     (IProceduralMesh aMesh) {
			aMesh.Build(true);
			Mesh m = aMesh.MeshData;
			
			if (m.name.Contains(procMeshPrefix)) {
				return;
			}
			
			string name = "";
			string file = "";
			GetUniquePath((aMesh as Component).gameObject, out name, out file);
			m.name = name;
			
			try {
				UnityEditor.AssetDatabase.CreateAsset(m, file);
				UnityEditor.AssetDatabase.Refresh    (       );
			} catch {
				Debug.LogError("Unable to save prefab procedural mesh! Likely, you deleted the mesh files, and the prefab is still referencing them. Restarting your Unity editor should solve this minor issue.");
			}
		}
Esempio n. 3
0
 public static Vertex GetNearestVertex(this IProceduralMesh thisMesh, Vector3 worldPoint)
 {
     return(thisMesh.GetVertices().OrderBy(vertex => Vector3.Distance(vertex.AsVector3, worldPoint)).FirstOrDefault());
 }
Esempio n. 4
0
 public static IEnumerable <Vertex> GetVertices(this IProceduralMesh thisMesh)
 {
     return(thisMesh.TriangleMeshes.SelectMany(triangle => triangle.Vertices));
 }
Esempio n. 5
0
 public void AddMesh(IProceduralMesh mesh)
 {
     Meshes.Add(mesh);
 }