Hi all, I’ve looked into it here and other places, but I can’t seem to work it out.
When I click my mouse, the object rotates on Y, but I’m trying to work out how to limit the rotation, I’ve been using Mathf.Clamp but I’m not having much luck.
Can anyone point me in the right direction?
I’m coding in C#.

	void Update () {
		if (Input.GetMouseButton (0)) {
						Debug.Log ("Input recieved");
						transform.Rotate (Vector3.up * Time.deltaTime * moveSpeed);
				}

		if (Input.GetMouseButton (1)){
						Debug.Log ("Input recieved");
						transform.Rotate (Vector3.up * Time.deltaTime * -moveSpeed);
				}

		transform.rotation = new Vector3(Mathf.Clamp(Transform.rotation.y, -90, 90));
}
}

are u sure this is not throwing an error… ??? rotation is a quaternion and you are storing a vector in it…

try transform.localEularAngles = new Vector3( x , mathf.clamp( y ,…) , z );