Answer the question
In order to leave comments, you need to log in
How to attach HPbar to 2d sprite?
Briefly about what I'm trying to do: Enemies will appear in the game and they will be damaged. They will appear the same, I will use a prefab and spawn it every certain time. Faced a problem in the form of attaching a health bar to the character.
Wargs are 2d objects with rb colliders and stuff, they move + turn. The xp bar is a UI element that I redesigned to look like an hpbar.
The question is, how do I attach my UI health bar to an enemy that moves and turns?
I tried it myself and ran into a problem, IMPORTANT, I'll throw it into the prefab later. If the canvas is not a child (then you get 2 prefabs, one canvas, and the second object, well, the enemy), then in order to put links later, I will have to use find by tag and other resource-intensive things, I don’t want to do this. But if I make canvas a child of my enemy, then during the rotation, my xp bar rotates with it, what should I do? (
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question