示例#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");
        }