I have this script when you hit this object a gui box appears. But it doesn’t work because I have to functions. Here is the script.
var MenuActive:boolean = false;
var collision : Collision;
function OnCollisionEnter(collision : Collision) {
// Debug-draw all contact points and normals
for (var contact : ContactPoint in collision.contacts) {
Debug.DrawRay(contact.point, contact.normal, Color.white);
}
if (collision.relativeVelocity.magnitude > 2)
unlockedLevels.levelOn++;
print ("Hit Target");
function OnGUI () {
if (MenuActive == true)
{
//show mouse cursor
Screen.showCursor = true;}
else {Screen.showCursor = false;}
if (MenuActive == true){
// Make a background box
GUI.Box (Rect ((Screen.width-200)/2,80,200,180), "Space BreakOut: Training Mode Complete");
//First button goes to
if (GUI.Button (Rect ((Screen.width-150)/2,110,150,20), "To Level Select")) {
Application.LoadLevel ("Level Select");
}
//Second button goes to second level
if (GUI.Button (Rect((Screen.width-150)/2,190,150,20), "To Next Level")) {
Application.LoadLevel ("Level 2");
}
}
}
}
So can anyone help me?