Pretty simple script but I have no idea!
var showGUI: boolean;
function OnCollisionEnter(coll: Collision) {
showGUI = true;
}
function OnCollisionExit(coll: Collision) {
showGUI = false;
}
function OnGUI() {
if (showGUI) {
GUI.Box (Rect (10,10,100,90), "Loader Menu");
// Make the first button. If it is pressed, Application.Loadlevel (1) will be executed
if (GUI.Button (Rect (20,40,80,20), "Level 1")) {
Application.LoadLevel (1);
}
// Make the second button.
if (GUI.Button (Rect (20,70,80,20), "Level 2")) {
Application.LoadLevel (2);
}
}
}
And i only used this gui as a test
change
function OnCollisionEnter(coll: Collision) {
showGUI = true;
}
function OnCollisionExit(coll: Collision) {
showGUI = false;
}
to
function OnCollisionEnter(coll: Collision) {
if(coll.gameObject.tag == "whatever tag")
{
showGUI = true;
}
}
function OnCollisionExit(coll: Collision) {
if(coll.gameObject.tag == "whatever tag")
{
showGUI = false;
}
}