I know this is a overly-simple problem, and I'm almost sure I'm just not attacking this correctly, but attaching this script to the camera causes the game to freeze when the appropriate mouse button is held. It remains frozen after releasing the button.
It is simply meant to rotate the camera around [0,0,0].
void Update()
{
while (Input.GetButton("Fire2"))
{
transform.RotateAround(Vector3.zero, Vector3.up, Input.GetAxis("Mouse X") * Time.deltaTime);
transform.RotateAround(Vector3.zero, Vector3.right, Input.GetAxis("Mouse Y") * Time.deltaTime);
}
}
system
2
Just dont use "while" construction. Update function checks every frame
system
3
This will solve your problem:
var button_down:boolean = false; //should be global var so it will save its state through frames
function Update()
{
if (Input.GetButtonDown("Fire2")) button_down=true; //button_down=true until you release button
if (Input.GetButtonUp("Fire2")) button_down = false;
if (button_down)
{
transform.RotateAround(Vector3.zero, Vector3.up, Input.GetAxis("Mouse X") * Time.deltaTime);
transform.RotateAround(Vector3.zero, Vector3.right, Input.GetAxis("Mouse Y") * Time.deltaTime);
}
}