unity lock rotation code example
Example 1: unity how to lock rotation
public float lockPos;
void Update()
{
// Locks the rotation.
transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, lockPos, lockPos);
}
Example 2: unity mouse lock
Cursor.lockState = CursorLockMode.Locked;