i have a hud for a game made with guitextures and gui.buttons i added it to an empty game object and added a donotdestroy to this function so that it would carry over health, mana, skillpoints etc to the next scene
the problem im having is i have an esc menu that can bring you back to the main menu screen (to adjust options or whatever) and the hud still appears! i would like the hud to be destroyed. i tried inputing a bool variable in the esc menu to be true to destroy hud and in my hud script i had
function Awake () {
if (destroygui ==true) { Destroy (this);} // also tried Destroy ("hud"); which is name of the game object else {DontDestroyOnLoad (this);}
}
// gui code below //etc etc
any ideas ?
thanks !