In my scripts I'm trying to locate two other components and disable them from an inventory system.
My Script:
private var showGUI : boolean = false;
function Update()
{
if (Input.GetKeyDown ("i"))
{
showGUI = !showGUI;
}
if (showGUI == true)
{
Time.timeScale = 0;
GameObject.Find("Player").GetComponent(ClickToMove).enabled = false;
GameObject.Find("PlayerCam").GetComponent(UserCamera).enabled = false;
}
}
The script detects the Gameobjects: "Player", and "PlayerCam", but it does not detect the component scripts: "ClickToMove", and "UserCamera", even though I've checked, double checked, renamed, and triple checked, that the files were there, and that the names matched it doesn't detect either of the two scripts.
Any help is greatly appreciated.
↧