Hello,
I’d like to create floating enemy health bars. I first was gonna use a Canvas per enemy but I read it was really inefficient.
But now I’m not sure how to create this ?
Should I have some canvas in the scene that will contain the healthbars and then make any instantiated enemy find this canvas object and set some value ?
Thanks for the help.
Inefficient compared to what? Efficiency is always measured in relation to something else. 
I think Canvas will do just fine. You won’t have thousands of them and even if you do, you can always swap it out with another implementation or simply limit the number of shown healthbars to a selection, or based on distance.
1 Like
If you are using UI Toolkit, then I would recommend separate UIDocument components but all of them sharing the same Panel Settings asset. If you look in the UI Toolkit Debugger you can see that all health bars are then part of one panel. Based on my testing, this is a good solution if you are concerned about performance.
Another approach would be to use world space UI instead where the UI is rendered to render textures. However, this will look and behave differently. See this video comparing world-space and screen-space UI