I want to know the lines of script to add on in order that when the player health = 0 or is destroyed, a GUIbutton is shown. I have tried to do this but it does not work. Here are the exerpts from my script-
Thanks,
void Update(){
health += Input.GetAxisRaw("Horizontal");
if (health < 0){
health = 0;
destroy = true;
Destroy();
}
void Destroy(){
if(GUI.Button(new Rect(100, 100, 100, 100),"Level Complete")){
Application.LoadLevel(1);
}
DaveA
2
The code would be the same in both languages. Just paste your js code into your c# class. Except instead of function OnGUI() it’s void OnGUI()
Did this and worked (did not use Destroy()):
void OnGUI()
{
if(destroy == true){
GUI.Box(new Rect(400,150,500,300), “Level Complete!”);
if(GUI.Button(new Rect(100,100,80,80),“Next level”)){
Application.LoadLevel(1);
}
}