Yup! If you store a reference to the script like this: var myLook : MouseLook; You can then put a boolean inside the script that turns it on and off like var switch : boolean = true;. After that, you’d just need to say myLook.switch = false; to turn it off and myLook.switch = true; to turn it on again.
Like all variables, the above myLook would have to have the object with the MouseLook script dragged onto it.
i try myself to open close a GUI Window but i cant
have it to stay in the screen
can you help me with the getkeydown and up to understand the way for enabled my inventory in gui
It does. The page just doesn’t explain clearly that this compilation ordering will solve your problem ;). It would probably help a lot of people if that manual page would explicitly mention the ‘does not denote a valid type’ error in the first paragraph.
For someone like me that is a Newbee, can you please post how this script would look. I am currently having issues with stopping camera controller once I make the switch. I am currently using the code from this site http://www.unifycommunity.com/wiki/index.php?title=SwitchCamera. But it doesn’t tell me how to disable the Mouselook or Thirdperson controller from the camera as I make the switch. If you can help me out with this, I would Greatly appreciate it
Camera.main.GetComponent("MouseLook").enabled = false;
var other = GameObject.Find("First Person Controller");
other.GetComponent("MouseLook");
var otherScript =other.GetComponent("MouseLook");
otherScript.enabled = false;
but its still not perfect.
And I havent figured how to enable it again.
I was told to use
function Awake()
{this.enabled = true; // or false
}