private void Awake() { meshCollider = GetComponent <MeshCollider>(); landformRenderer = GetComponent <LandformChunkRenderer>(); collisionMesh = meshCollider.sharedMesh = CreateMesh(); landformRenderer.OnHeightChanged += UpdateMesh; }
private void UpdateMesh(LandformChunkRenderer renderer) { if (collisionMesh == null) { collisionMesh = meshCollider.sharedMesh = CreateMesh(); } else { UpdateMesh(ref collisionMesh); meshCollider.sharedMesh = collisionMesh; } }