- Home /
[uGUI] Performance on Color Lerping
I noticed that there's a big drop in performance when trying to change the color property of multiple numbers (around 20+) of Image/Text components.
I'm using this behavior for my action game where lots of damage numbers pop up then fade out. First, I thought it was a problem of creating those number objects since I'm not pooling them. I turned off the script that lerps the color over a set time and the game is smooth again (my first guess was wrong)
Another thing, after I built it for web, it seems that the game is smooth again. I'm assuming that this is an editor-only performance drop but I don't know of a way to test that.
This wasn't an issue when I was using tk2d before. As much as possible I want to make use of whatever is already available in Unity.
My question is: Is there a way to efficiently fade the color out? Or since this is beta, it's still an issue?
Thanks!
I met the same problem when I add an animation to change the color. Is there any solution until now?
When you assign a color to a uGUI element Unity creates materials, and re-renders all the GUI hierarchy that is below that UI element. This is messy and not very performant.
However, if you only want to modify the alpha of UI element, try it using a CanvasGroup and set its alpha property to the desired value. It seems to work a lot faster.
Your answer
Follow this Question
Related Questions
How can I calculate whether an UI element is inside my camera view? 0 Answers
How can I use unity 4.6 gui to have a health bar that follows my enemy in world space? 3 Answers
Unity4.6 - Setting text Property on Text Object 1 Answer
uGUI: Choose parent for anchors 0 Answers
3D object in uGUI 3 Answers