Health bars above enemies but for some reason while I move, they are offsetted.

Hi guys!

I started making Health Bars above enemies in my game made in Unity.

But for some reason, if I’m moving, it’s offsetted in that direction.


The health bar is on an Overlay canvas, and contains basic images.

The parent:


The code is pretty simple, in FixedUpdate:

healthBar.transform.position = Camera.main.WorldToScreenPoint(target.position)

GIF: https://i.imgur.com/K8mwzTW.mp4


Any ideas? :smiley:

Thanks in advance!

Fixed.

Instead of FixedUpdate, it should be in LateUpdate.