Saturday, 31 August 2013

When I disable MouseLook in Unity, I can still look up and down

When I disable MouseLook in Unity, I can still look up and down

I made a pop up menu and when it comes up, I don't want to be able to move
or look around. The movement part is all good, but when I disable
MouseLook, I can still look up and down. How can I fix this? Also, I don't
want to freeze the game time because I might add multiplayer later and I
don't want it to freeze the game for other players. Any help will be
appreciated.
Here's my code:
if(canOpen == true && isOpen == false && Input.GetKeyDown(KeyCode.E)) {
isOpen = true;
canClose = true;
player.GetComponent<FPSInputController>().enabled = false;
player.GetComponent<CharacterMotor>().enabled = false;
player.GetComponent<MouseLook>().enabled = false;
}
else if(isOpen == true && Input.GetKeyDown(KeyCode.E) && canClose ==
true) {
isOpen = false;
canOpen = false;
player.GetComponent<FPSInputController>().enabled = true;
player.GetComponent<CharacterMotor>().enabled = true;
player.GetComponent<MouseLook>().enabled = true;
}

No comments:

Post a Comment