Hello,
I have a problem: i can’t disable a script from an other script. why?
I am making a menu, and i want to stop my player moving, when it is on pause. Or is there an other way to do it?
// the var 'P' = pause
static var P=0;
function Update () {
// i did define the escape button!
if(Input.GetButtonDown("esc")){
P=1;
}
}
function OnGUI()
{
if (P==1){
Screen.showCursor = true;
GUI.Box(Rect(-45,0,2000,1000), "Pause");
if(GUI.Button(Rect(910,300,100,30), "Resume")){P=0; Screen.showCursor = false;}
if(GUI.Button(Rect(910,500,100,30), "Exit")){Application.Quit();}
/*Error-->*/ gameObject.Find("FirstPersonControllerPrefab").FPSWalker = false;
/*Error-->*/ gameObject.Find("FirstPersonControllerPrefab").FPSWalker.enable = false;
/*Error-->*/ gameObject.Find("FirstPersonControllerPrefab").FPSWalker.false;
/*Error-->*/ gameObject.Find("FirstPersonControllerPrefab").FPSWalker.active = false;
}
}
Please help! ASAP!!! :-/