GenerateMesh() public static method

public static GenerateMesh ( int _rows, int _columns, float _quadSegmentSize ) : Mesh
_rows int
_columns int
_quadSegmentSize float
return UnityEngine.Mesh
Exemplo n.º 1
0
        private void UpdateMesh(int rows, int columns, float quadSegmentSize)
        {
            if (Application.isPlaying)
            {
                return;
            }

            MeshFilter meshFilter = this.waterVolumeTarget.GetComponent <MeshFilter>();
            Mesh       oldMesh    = meshFilter.sharedMesh;

            Mesh newMesh = WaterMeshGenerator.GenerateMesh(rows, columns, quadSegmentSize);

            newMesh.name = "Water Mesh Instance";

            meshFilter.sharedMesh = newMesh;

            EditorUtility.SetDirty(meshFilter);

            if (oldMesh != null && !AssetDatabase.Contains(oldMesh))
            {
                DestroyImmediate(oldMesh);
            }
        }
        private static void CreateMesh()
        {
            Mesh mesh = WaterMeshGenerator.GenerateMesh(5, 5, 1f);

            AssetDatabase.CreateAsset(mesh, "Assets/Water Buoyancy/Models/Water Mesh.asset");
        }