- Home /
DontDestroyOnLoad doesn't work
I made a script and gave it to the camera. The script shouldn't make so the camera gets destroyed when a new level loads. But it still gets destoryed. How can I fix it?
I am using the code from the Unity site.
function Awake () {
DontDestroyOnLoad (transform.gameObject);
}
For the moment I also only have one level. It is when I die, the level gets reset. Does that have to do with anything?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613114811im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Game Works on Computer, but not on iPhone 0 Answers
Main Menu scrpit not working 1 Answer
Unity 3d android not working 1 Answer
Ocean not rendering (only during runtime) 1 Answer
Mono - Develop not working? 1 Answer