function LateUpdate () {
if (isCameraInputIgnored() ) {
return;
}
if (target && Input.GetMouseButton(0)) {
x += Input.GetAxis("Mouse X") * xSpeed * 0.02;
y -= Input.GetAxis("Mouse Y") * ySpeed * 0.02;
y = ClampAngle(y, yMinLimit, yMaxLimit);
var rotation = Quaternion.Euler(y, x, 0);
var position = rotation * Vector3(0.0, 10.0, -distance) + target.position;
transform.rotation = rotation;
transform.position = position;
}
}
This is the function that rotates my object. When i hit play and click on mouse (doesn’t matter where I’m on the screen) my camera is changing it’s position by setting . Any ideas on how to stop that ?


I’ve added 2 pictures for details. i hope to understand what is my problem.
I solve it by changing the camera position in the inspector.