public void ApplyAmbient() { if (ambientWorker.stop) { return; } //empty mesh check if (ambient == null || hiMesh.vertexCount == 0) { return; } #if WDEBUG Profiler.BeginSample("Apply Ambient"); #endif //hi mesh int[] hiTris = hiMesh.triangles; Vector2[] hiAmbient = ChunkMesh.SetAmbient(ambient, hiTris, indexToCoord, hiMesh.vertexCount); hiMesh.uv4 = hiAmbient; //lo mesh Vector2[] loAmbient = new Vector2[loMesh.vertexCount]; for (int i = 0; i < loAmbient.Length; i++) { loAmbient[i] = hiAmbient[i]; } loMesh.uv4 = loAmbient; //grass if (grassMesh.vertexCount != 0) { Vector2[] grassAmbient = ChunkMesh.SetGrassAmbient(ambient, grassMesh.vertices, grassMesh.triangles, grassMesh.uv4, transform.localPosition); grassMesh.uv4 = grassAmbient; } #if WDEBUG Profiler.EndSample(); #endif }