Hello,
My team is using HyperText in a large Unity project with Unity's GUI, and we are getting large allocations (around 8.5kb) every 24 frames or so while updating a text field each frame. We do not receive this allocation with the UnityEngine.UI.Text component.
The problem seems to come from two sources: HyperTextProcessor.ProcessInputText(), and HyperText.OnPopulateMesh(). Each one is allocating roughly 4kb during these spikes.
From what I gather, what is happening is that, as the Text.text string is updated, Unity is calling LayoutRebuilder.Rebuild() and Graphic.Rebuild(), and those are eventually leading to the ProcessInputText() and OnPopulateMesh() methods, respectively. If the Text.text property is not updated, these never get called.
I understand HyperText will need to do some calculations as strings are updated, but all we are doing is updating a date and time string in realtime, and need the barest minimum of formatting options (really, just that our style changes are respected, otherwise we would use Unity's Text).
My question is, is there a way to update text but avoid triggering these large allocations? Or any known way we can use HyperText or structure our UI hierarchy that maybe doesn't trigger them?
Thanks,
Dave