Can't understant how to set my health bar GUI to behave nice

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?

I don’t think you want to be using “OnGUI”, that is for the legacy UI system and the editor. You probably want to do that in “Update”. And if you attach that script to the world space canvas it will turn all its children as well.

Thanks for the answer Ramcat.
So, after some deep google diving I found nice solution for this:

        transform.LookAt(transform.position + Camera.main.transform.rotation * Vector3.forward,
                         Camera.main.transform.rotation * Vector3.up)

I have no idea why this is working, but maybe it will help someone :d
Still I have no idea how people made health bar to stay on place when camera rotates around unit, but I just turn off camera rotation.