I think there is no way to manage depth at runtime except for chaning sorting order at Canvas.
so I make each ui composition attached a canvas for it and also make it into prefab for instantiating as I want.
is it ok to use canvas like it?
I think there is no way to manage depth at runtime except for chaning sorting order at Canvas.
so I make each ui composition attached a canvas for it and also make it into prefab for instantiating as I want.
is it ok to use canvas like it?
Yes. Canvases actually have a lot of layering problems that can only be solved by using multiple canvases.
The only thing to keep in mind is that canvases are relatively expensive on the GPU, as they render their contents to a renderTexture before rendering it to the scene. If you notice framerate issues and you have several canvases, that may be the problem.
Precisely because of the performance reasons desribed by @MSplitz-PsychoK I would advise you to use Panels instead. If you are also interested in the more philisophical side of the “Canvas VS Panels debate” you might find this thread a fun read: Scenes vs Canvases vs Panels - Unity Engine - Unity Discussions