# Unity Graphics.DrawMesh lags behind rotation?

I have a setup in unity using Graphics.DrawMesh() to draw a mesh on my players camera location in the update loop, Graphics.DrawMesh(viewModel, matrix, material, layer, null, 0); matrix = Matrix4x4.TRS(cam.transform.position, cam.transform.rotation, scaleFps); when I use my mouse to move around the camera, it lags behind where the camera is, as can be seen in the video. I have no idea how to fix this. I've tried not using the matrix, and it doesn't change anything.

https://youtu.be/eWFFYcOX_4Q

Here's the script I use for moving the camera:

    //Get the current mouse input.
yaw += Input.GetAxis("Mouse X") * mouseSensitivity;
pitch -= Input.GetAxis("Mouse Y") * mouseSensitivity;

//Clamp the camera rotation.
pitch = Mathf.Clamp(pitch, -maxLookAngle, maxLookAngle);

//Calculate and rotate the camera.
currentRotation = Vector3.SmoothDamp(currentRotation, new Vector3(pitch, yaw), ref rotationSmoothVelocity, mouseSmoothScale);

//Rotating the player.
Vector3 bodyRotation = new Vector3(0, currentRotation.y, 0);
transform.localEulerAngles = bodyRotation;

//Rotating the camera.
Vector3 cameraRotation = new Vector3(currentRotation.x, 0, currentRotation.z);
playerCamera.transform.localEulerAngles = cameraRotation;'

• Remember, we don't just need the code that moves the camera. We also need to see when that code is called. Are you doing each of these operations in Update, or is one in LateUpdate or even FixedUpdate? This is always important in a Unity question, so it's best if we never crop out the method itself. – DMGregory Jan 7 at 12:12
• I fixed it by putting the render in lateupdate. – Stumpy Jan 7 at 23:13
• That sounds like something worth posting as an Answer then! – DMGregory Jan 7 at 23:15