Okay so I was just making a game i spent alot of time on it and saddy i deleted it on accident so I was trying to type my long script over again and it is not working.
here is the code:
var Glock17 : GameObject;
var Glock17Aim : GameObject;
private var ShowMenu = false;
private var Rank = 0;
private var Kills = 0;
private var EXP = 0;
private var Wave = 0;
function Start () {
Glock17.SetActive(true);
Glock17Aim.SetActive(false);
}
function Update () {
if(Input.GetMouseButtonDown(1)) {
Glock17.SetActive(false);
Glock17Aim.SetActive(true);
}
if(Input.GetMouseButtonUp(1)) {
Glock17.SetActive(true);
Glock17Aim.SetActive(false);
}
ShowMenu = true;
if(ShowMenu == false) {
if(Input.GetKeyDown ("space")) {
ShowMenu = true;
}
}
if(ShowMenu == true) {
if(Input.GetKeyUp ("space")) {
ShowMenu = false;
}
}
}
function OnGUI() {
if(ShowMenu == true) {
GUI.Box (Rect(0, 0, 640, 480), "Pop Up" );
GUI.Box (Rect(0, 0, 640, 480), "Pop Up" );
GUI.Box (Rect(0, 0, 150, 480), "Stats" );
GUI.Box (Rect(0, 0, 150, 480), "Stats" );
GUI.Box (Rect(200, 0, 130, 130), "" );
GUI.Label (Rect(0, 0, 130, 130), "Wave:" + Wave );
}
}
Some of the GUI stuff dont work. and the vars dont. Sigh
well thanks ![]()
Unity doesn't use Java. If you're trying to say "Javascript", that's a different language entirely; Java can't be used as shorthand for it. Sorry to be picky, but programmers should know this.
– Eric5h5Some of your GUI lines are duplicated. What specific problem are you having?
– Graham-DunnettYou cannot display Wave as an int (or float, who knows what Wave is with dynamic typecasting) in GUI, you need to convert it to a string : GUI.Label (Rect(0, 0, 130, 130), "Wave:" + Wave.ToString() ); this is what I gleaned from Some of the GUI stuff dont work. and the vars dont.
– AlucardJayBesides clearing the confusion of Java and Javascript, you may also consider restyle your code with better indentation. :D
– willkzhang