- Home /
FPS problem with Multi-Colored text on Unity 5 uGUI via Rich Text
Hello everyone.
So i have the following problem: i have a prefab which i instantiate and then fill it's GetComponent().text =
("<color=#FFC300FF>" + string1+ "</color> <color=#E11010FF>" +string2+ "</color> <color=#13A01AFF>" + string3+ "</color>");
After that i parent every prefab in a ScrollRect and create scrolling list. All of the above during Start(){}
The prefab is simple, it has two text components and two images which for now are filled with a color. Problem is that scrolling said list causes EXTREME FPS Loss.
Even using just one color it causes big drop in frames.
Is there any way around this. I need to show x different stats with x different colors in a single text Component(new UI not GUI). Is there a way to do that, so it doesn't kill fps that much (some cpu usage is expected but this much is killing a 3.2Ghz core cpu let alone mobile which is the target).
Seems like every time i scroll the list and an item is replaced by another, the new one seems to be recalculated from scratch or something but there shouldn't be a need for that cause all of the objects are the same (same X colors at X position for X elements minus the text change).
Android had a similar issue with their ListView but what they did was recycle the list element instead of Garbage Collecting it. This way maybe Graphic.Rebuild wouldn't be needed as much and Graphic.Refill() (if it existed) would be a better option? P.S 1st time posing here, low experience with Unity, Using C#. Thanks in advance.