// LateUpdate is called once per frame void LateUpdate() { // Use late update so this happens after the camera moves, preventing lagging shadows. if (mesh_filter == null) { return; } mesh_filter.mesh = FullscreenMesh.Mesh(0.5f, -1.0f * new Vector3(transform.position.x, transform.position.y, transform.position.z)); }
// Update is called once per frame void LateUpdate() { // Use late update to ensure the camera has finished moving BEFORE this sets the mesh position based on it: prevents "lagging shadows". GetComponent <MeshFilter>().mesh = FullscreenMesh.Mesh(0.5f, Vector3.zero); //Generate a simple full-screen mesh at z = 0.5 for rendering lights / shadows. }