- Home /
I created a HUD using new UI in Unity 5. I want to display that HUD in all levels.
I created Pause button, restart button and other HUD elements using new UI. And I created a Public function for button click actions. Now I want HUD to display in all my levels.
Answer by Cherno · Jul 19, 2015 at 07:12 PM
You can use DontDestroyOnLoad to prevent objects from being destroyed when changing scenes. Use this with your canvas objects, and other objects related to your UI, and they will stay as they are no matter what scene you load during runtime.
Thanks a lot !!.. I used what I knew all these days. I made all the new elements as prefab and its working perfectly fine.
Your answer
![](https://koobas.hobune.stream/wayback/20220611232002im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Drawing UI text on GUI.DrawTexture , How to do it ? 1 Answer
Problem with build version 1 Answer
Unity5 WheelCollider UI not showing???? 4 Answers
How to change a buttons color? 2 Answers
Collapsible Side Menu 1 Answer