Search Unity

Canvas gets destroyed after I build my game

Discussion in 'Editor & General Support' started by Pavlos_Mavris, Dec 19, 2019.

  1. Pavlos_Mavris

    Pavlos_Mavris

    Joined:
    Sep 17, 2018
    Posts:
    57
    Hello everyone I have a question about the canvas. I want to make a game with many different levels(Scenes) but I want my canvas to be the same in all of my scenes. But when it comes the time to make a change inside the canvas I want to do it once and be applied in all of my scenes without doing it one by one separately for each scene. I try to make my canvas as a prefab but when i'm building the game the whole canvas is not working(the buttons on it) or sometimes is destroyed. I'm wondering if there is a different way to do it.

    Thank you.
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    There's nothing wrong doing it as a prefab. No idea why your buttons wouldn't work, or where in your game the canvas is getting destroyed from what you've posted.

    An alternative way is doing it as its own separate scene which you additive load alongside your existing scenes. Basically a UI scene. This is usually how I do it. I take everything common for all levels and put all that in a single scene, which usually includes all the UI functionality, and then create separate scenes for each level which just have anything unique to that level.