- Home /
Few canvases or 1 Canvas to control all UI
I have 1 scene, in that scene the Time.timeScale = 0; until the Start button is pressed, now, I thought about making a few Canvases - Start game, end game and in-game to display score, but all of these stuff could be done in 1 Canvas, just enable and disable UI elements inside that canvas when i need too, what would be best? make a few Canvases, for each game phase, or 1 to control everything?
Answer by Addyarb · Apr 23, 2015 at 10:26 AM
Using one canvas is generally recommended for most intents and purposes. There are a few situations where you'll find it's easier to have multiple canvases though. For general UI (buttons, title screen, windows), I would use one canvas. For things like health bars for enemies, damage indicators, etc., I personally use an individual canvas in world space for each enemy.
Answer by BroVodo · Apr 23, 2015 at 06:59 PM
I use multiple canvases on my project because you can just disable the canvas (and everything in it) with a line of code rather than manually disabling every UI element.
I found that disabling UI gameobjects meant you couldn't set up buttons properly if they were disabled at the start of the scene.
Nesting canvases made some of the stretching properties do strange stuff as well.
If a top canvas stretches over a lower canvas, the top canvas will also block interaction/clicks on the lower canvas, even if that part of the top canvas is empty or invisible.
After experimenting with a few canvases and one canvas I found it easier to use 1 canvas and make a few panels inside, that way you have 1 start 1 in game and 1 death, and just play between them, no need in more unless you have few scenes
Sounds good, it might have just been my use case. How do you activate and deactivate stuff in the panels? I remember trying exactly the same setup (deactivating the panel game object?) but it wasn't right for me for some reason... I think it had to do with deactivating game objects like buttons at the start but needing to make some buttons interactable and some not, when they finally were activated by their parent panel.
Your answer
![](https://koobas.hobune.stream/wayback/20220613193833im_/https://answers.unity.com/themes/thub/images/avi.jpg)