So, I created a small canvas around unit in my rts and placed a image with health bar texture. Its working nice, but when I’m playing with the camera in game its starts to behave not like in other classical rts game. I dont know how to exactly describe this, but in other games when im moving and rotate camera its looks like health bar stays on the place, but always facing a camera. In my case its starts rotates at all axis, so sometimes it’s even overlaps unit. Here is small line of code which Im using to rotate my health bar image:
void OnGUI()
{
this.transform.LookAt (Camera.main.transform.position);
}
And, as I understand - if I want to make health bar with some border around to show how much health gone, I need to add second background image with borders? And rotate it with my main image?