i got a script here but i cannot use it. There is no text being shown out. What i want is, when i click on an object, a textbox will appear telling me what the object is. Can anyone give me a hand ?
var infoText : GUIText;
private var infoMark : boolean = true;
function OnMouseDown () {
/*
if (pickupType == PickupType.FuelCell) {
var answer : boolean =false;
var playerThirdPerson = GameObject.Find(“Player”);
playerThirdPerson.GetComponent(ThirdPersonController).walkSpeed = 0;
playerThirdPerson.GetComponent(ThirdPersonController).trotSpeed = 0;
*/
var playerFP = GameObject.Find(“First Person Controller”);
playerFP.GetComponent(FPSWalker).speed = 0;
if(gameObject.name == “Photo Frame 2”) {
infoText.guiText.text = " Air-Well in a Shophouse: " +
"\n Shop houses are small built and there are only several openings to let the air flow for ventilation. " +
"\n Hence, Air-well was built for the purpose of natural lighting and ventilation. The occupant of the " +
"\n building also uses the Air-well to dry their laundry and collect rain water. The Air-well is effective " +
"\n yet simply built. An Air-Well is considered to be one the most prominent icon of the Shop house. " +
"\n \n When you finish your reading, enter ‘R’ to remove the question mark and proceed … " ;
yield new WaitForSeconds (3);
}
else if(gameObject.name == “Photo Frame 1”) {
infoText.guiText.text = " Ironing area n Air Well: " +
"\n Sewing machine wheel… " +
"\n Sewing machine wheel… " +
"\n Sewing machine wheel… " +
"\n Sewing machine wheel… " +
"\n \n When you finish your reading, enter ‘R’ to remove the question mark and proceed … " ;
yield new WaitForSeconds (3);
}
while (infoMark) {
if (Input.GetKey(“r”)) {
infoMark = false;
break;
}
else yield new WaitForSeconds (0.2);
}
playerFP.GetComponent(FPSWalker).speed = 6;
infoText.guiText.text = " " ;
Destroy(gameObject);
}