- Home /
Question by
allenziff · May 09, 2012 at 05:22 PM ·
guigameobjectdestroyappear
GUI Appear Help
im trying to make GUI appear after the gameobject was been destroyed. heres my script im using:
var MaxHealth : int = 500;
var CurrentHeath : int;
function Start () {
CurrentHeath = MaxHealth;
}
function ApplyDamage ( Damage : float ) {
if( CurrentHeath < 0){
return;
}
CurrentHeath -= Damage;
if( CurrentHeath == 0 ){
Destroy( gameObject) ;
}
}
thanks for your help
P.S im new to scripting
Comment
Best Answer
Answer by kolban · May 09, 2012 at 05:27 PM
What you will like want to do is create a new Prefab game object definition with an attached script that shows the GUI. After you execute the Destroy() of your current game object, you will want to use Instantiate to create a new instance of the Prefab.
Either that or having a single object handling those kinds of GUI. When the allenziff's object is Destroy, he can somehow access that object and tell it to display something with any way he wants, boolean, adding something to a list, etc.
Your answer
![](https://koobas.hobune.stream/wayback/20220613071305im_/https://answers.unity.com/themes/thub/images/avi.jpg)