This Is My Script. It’s Attached To GUI Texture. When I Click It First Person Controller And F.P. Camera Scripts Are Deactivated And Car And Car Camera Scripts Are Activated (Like You Sit In Car). When I Click GUI Texture Unity Quits (With Windows’s “Send Error Report” Window). Please Help!!!
I Have Windows 7.
var buttonType : String = "Drive/XTools";
var FPController : GameObject;
var car : GameObject;
var carCamera : GameObject;
var fPCamera : GameObject;
var gui1 : GameObject;
var gui2 : GameObject;
var guix : GameObject;
function OnMouseDown ()
{
if(buttonType == "Drive")
{
FPController.GetComponent("Character Controller").enabled = false;
FPController.GetComponent("Mouse Look").enabled = false;
FPController.GetComponent("Character Motor").enabled = false;
FPController.GetComponent("FPSInput Controller").enabled = false;
fPCamera.GetComponent("Camera").enabled = false;
car.GetComponent("Car").enabled = true;
carCamera.GetComponent("Camera").enabled = true;
gui1.GetComponent("GUI Texture").enabled = false;
gui2.GetComponent("GUI Texture").enabled = false;
guix.GetComponent("GUI Texture").enabled = false;
}
}