- Home /
DontDestroyOnLoad duplication.
I have checked EVERYWHERE on Unity answers to find something useful and I found nothing. Please help. I am trying to make tutorial text that says something when you die. This is my script (death text is stated elsewhere) . I don't want it to duplicate but I want it to show the death text.
function Start () {
DontDestroyOnLoad(transform.gameObject);
}
function Update () {
}
var text = "Use WASD to move.";
var info_level1 : GameObject;
guiText.text = text
I would like the answer in Javascript
Thanks!
quoting from unity script reference:
$$anonymous$$akes the object target not be destroyed automatically when loading a new scene.When loading a new level all objects in the scene are destroyed, then the objects in the new level are loaded. In order to preserve an object during level loading call DontDestroyOnLoad on it. If the object is a component or game object then its entire transform hierarchy will not be destroyed either. Is this what you want? You want this tutorial-guide-thing to survive whenever you load a new scene? It that so, you would be better off with writing DontDestroyOnLoad (transform.gameObject) inside the Awake function ins$$anonymous$$d.