I am creating a 3D game, and I am trying to add enemies to it. These enemies are added dinamically when my character gets close to them. I do it by using the "add_child" method within the main node.
It works perfectly fine, but when I add a 2D healthbar implemented with a progressive viewport texture, the performance to add (not to create) the enemies scenes drops a lot, and even make my screen freeze for even more than 1 second.
When I comment the code to add the 2D healthbar, the enemies scenes are added very smoothly.
Depending the area my character is, it maybe creates more than 10 enemies, which means more than 10 viewports for the healthbars.
I think I should use another way to do it. Do you guys have any tips, better way to do it? Or am I doing something very wrong?