Unity UI slow?(WaitingForJob and Canvas.RenderOverlays related problem)

I have a game where the enemies have a health bar above their head made with Unity(5.2) UI, but if I enable the UI my game fps goes from 1000 fps to 100 fps(see image of profiler). How can I fix this??
This is (a part of) my code:

public RectTransform healthBar;
 public RectTransform healthBarChild;
 private int curHealth;
 private int maxHealth;
 private float maxScale;
 private Vector3 offset;
 private Transform canvas;
 
 void Start()
 {
     canvas = Global.canvas;
     healthBar = Instantiate(healthBarPrefab).GetComponent<RectTransform>();
     healthBarChild = healthBar.GetChild(0).GetComponent<RectTransform>();
     maxScale = healthBarChild.sizeDelta.x;
     healthBar.SetParent(canvas);
 }
 
 void Update()
 {
     healthBar.position = Camera.main.WorldToScreenPoint(transform.position+ offset);
 }
 
 void onDamage(int damage) // is called when enemy gets damage
 {
     curHealth -= damage;
     Vector2 curSize = healthBarChild.sizeDelta;
     curSize.x = curHealth / (float)maxHealth * maxScale;
     healthBarChild.sizeDelta = curSize;
     if (curHealth <= 0)
     {
         die();//I didn't include this(and some other functions) as it is not necessary
     }
 }

Please answer, this is really important! Thanks in advance.

Hmmm… Your code looks fine to me. I think your issue is probably the effect of something else, probably the number of things in your UI or some other GameObject.

The only thing in your code that would cause any kind of slowdown would really be this
“healthBar.position = Camera.main.WorldToScreenPoint(transform.position+ offset);”
But that should still be very fast. If Camera.main does a search for the tagged main camera every frame it may be a cause. But 5ms just for that sounds a bit large.