Unity TextMeshPro bounds.size is wrong when hovering first time over gameobject

I have this weird issue, which I am not able to fix. This is my third attempt and I need some help. Basically I have a hover element which spawns when I hover over a gameobject. The height of the element is determined by the amount of text (TextMeshProUGUI).

The issue happens only when I hover first time, also not always (I have no clue how to reliably to reproduce it).

Here is what happens (sec 10~):

I have tried to add these everywhere and different combinations:

LayoutRebuilder.ForceRebuildLayoutImmediate(hoverElementRect); hoverElementRect.ForceUpdateRectTransforms(); Canvas.ForceUpdateCanvases(); txtMeshPro.ForceMeshUpdate(); 

They dont seem to help. I assume the problem is here:

float bgHeight = txtMeshPro.bounds.size.y + 25; 

The bounds.size.y is wrong the first time I hover, but I have no clue why.

Here is the whole code for spawning the GUI element:

public static void SpawnGeneralHoverElement(string descText, RectTransform hoverOverRect, float guiWidth) {     Canvas hoverCanvas = instance.hoverElementGeneral.GetComponent<Canvas>();     EnableCanvas(hoverCanvas);      TextMeshProUGUI txtMeshPro = hoverCanvas.GetComponentInChildren<TextMeshProUGUI>();     RectTransform hoverElementRect = hoverCanvas.GetComponentsInChildren<RectTransform>()[1];      float scale = hoverCanvas.GetComponent<RectTransform>().localScale.x;      txtMeshPro.text = descText;      // Need this to be dynamic, if I change hover element size, it will still work     float hoverElementWidth = guiWidth;      // Forces canvas update because of: stackoverflow.com/questions/55417905/why-is-textmeshpro-not-updating-textbounds-after-setting-text     Canvas.ForceUpdateCanvases();     LayoutRebuilder.ForceRebuildLayoutImmediate(hoverElementRect);     hoverElementRect.ForceUpdateRectTransforms();     txtMeshPro.ForceMeshUpdate();      // Need this because otherwise the element spawns too far away on smaller resultions     float spawnOffset = (txtMeshPro.bounds.size.y * hoverCanvas.GetComponent<RectTransform>().localScale.x) + (Screen.height * 0.022f);      float bgHeight = txtMeshPro.bounds.size.y + 25;      hoverElementRect.position = new Vector3(hoverOverRect.position.x, hoverOverRect.position.y + spawnOffset,         hoverOverRect.position.z);      hoverElementRect.sizeDelta = new Vector2(guiWidth, bgHeight);     Debug.Log(hoverElementRect.sizeDelta);      LayoutRebuilder.ForceRebuildLayoutImmediate(hoverElementRect);     hoverElementRect.ForceUpdateRectTransforms();     Canvas.ForceUpdateCanvases();     txtMeshPro.ForceMeshUpdate();      // Slide in form left to right if off bounds, need for traps for example     float leftOffset = hoverElementRect.position.x - ((hoverElementRect.sizeDelta.x * scale) / 2);     if (leftOffset < 0) {         hoverElementRect.position = new Vector2(hoverElementRect.position.x + (leftOffset * -1) + 15, hoverElementRect.position.y);     }      // Slide in form right to left if off bounds, need for traps for example     float rightOffset = Screen.width - (hoverElementRect.position.x + ((hoverElementRect.sizeDelta.x * scale) / 2));     //Debug.Log("Screen width: " + Screen.width + "\nrightOffset: " + rightOffset);     if (rightOffset < 0) {         hoverElementRect.position = new Vector2(hoverElementRect.position.x - (rightOffset * -1) - 15, hoverElementRect.position.y);     }      LayoutRebuilder.ForceRebuildLayoutImmediate(hoverElementRect);     hoverElementRect.ForceUpdateRectTransforms();     Canvas.ForceUpdateCanvases();     txtMeshPro.ForceMeshUpdate();  }