I’m trying to create a system where if you click on an object, it’s name shows up on the GUI. This is my selection script (Object):
var objectName : String;
var reciever : GameObject;
function OnMouseDown () {
reciever.BroadcastMessage ("Selected", objectName);
}
So when you click on the object it broadcasts to the Main Camera.
This is the GUI script:
var selected : String;
var guiHeight = 250;
function OnGUI() {
GUI.Box(Rect(Screen.width / 4,695,Screen.width / 2,guiHeight),selected);
}
function Selected (damage : String) {
selected==damage;
}
Now my problem is that, though there are no errors, it doesn’t work. The GUI string doesn’t change.
Thanks, it worked.
– CatinBag987u're welcome :D
– sasuke908o and dont forget to accept the answer! :D
– sasuke908