For my game I’m making a crosshair, and I have an aiming script, I added a crosshair, but every time I aim the Ui also moves, I want it to just stay in the middle not move while also aiming. The code for aiming is in the answers.
Vector3 target = normalLocalPosition;
if (Input.GetMouseButton(1)) target = aimingLocalPosition;
Vector3 desiredPosition = Vector3.Lerp(transform.localPosition, target, Time.deltaTime * aimSmoothing);
transform.localPosition = desiredPosition; }