Is there any way of setting the text in a UILabel without allocating memory?
We have some code that is setting the current score every frame like this like this:
stringBuilder.Remove(0, _stringBuilder.Length);
stringBuilder.Append(DistanceCurrentScore);
string textScore = stringBuilder.ToString();
scoreLabelHUD.text = textScore;
And this causes memory allocations every frame because UILabel.text is a string, which is immutable, so has to be recreated every time we want it to change.
Is there an alternative way of setting a text value for a UILabel which doesn't allocate memory?