[5.2] Terrible performance spike causing by Font cache

[Unity 5.2.3p2 seems to fix the problem, thanks Unity !]

Hi again, I’m continue to port my project in Unity 5.2

I notice a terrible game freeze when open my UIs, due to “Font.CacheFontForText”, which taking 3273ms (!), vs nothing in Unity 5.1.3. My UI doesn’t contain a ton of text so… What’s going on ? Does something change about using Text on UI in term of best pratices ?

1 Like

Are you using best fit?

Yes, almost everywhere, our UIs are responsive.

Is there a bug about this right now ?

I think their might be yes. I think it generating too many font sizes where its not suppose to.

Hmm okay, thanks for the answer.

It’s very blocking us from releasing right now, when can we expect a patch on this ?

Thanks in advance

i’m not sure when a patch would be ready as i’m not the one doing the font changes. I’ll do my best to poke the guy responsible.

Thanks !

I’m experiencing what seems to be the same or a similar issue. Spawning my UI can take anywhere from 100ms to 725ms, technically, but Unity Editor hangs for a few seconds during that time (I get an OSX beachball in the more extreme cases) and the profiler doesn’t seem to report the seconds-long hitch. The UI panel I spawned that took 725ms just now doesn’t have any Text components with the Best Fit flag checked. It has two ScrollRect components with 3 buttons each, and those buttons each have two child Text components. It’s hardly a complex UI, but since upgrading to 5.2, Unity can’t handle it.

3 Likes

Do you get those spikes only in editor ? Because it was (worse) on Android too for us.

I haven’t seen them in iOS, fortunately, but I haven’t tried our game on Android yet.

We’re having the same problem. Huge lag spikes from Font.InvokeTextureRebuilt_Internal() not seen in 5.1. We don’t use “Best Fit” anywhere, and even normalize font sizes to 18, 24, 32, 64 etc. to minimize the font texture size.

Glad I’m not alone :slight_smile: We can’t use 5.2 with this bug, we revert to 5.1.3 for now

Any updates about this ?

Thanks a lot

I have the same issue, when I SetActive(true) a panel that has Best Fit enabled on just 6 Text components, it takes ~1000ms, whereas a similar panel without Best Fit enabled is instant.

I have the same problem with Fonts: (5.2) Performance Issues - Unity Engine - Unity Discussions

It worked fine upto v5.1.3p3 (included).

Yep, your first screen is what we face. Can you send a bug report if you can, with project attached ? I couldn’t be able to reproduce it, only on my big project and I don’t want to send 2.5Gb

I don’t see an issue tracker for this. Has anyone filed a bug?

I couldn’t create a repro project and my main project is private and too big. Sorry.

Ditto.

Hi, this bug is happening again on 5.2.1p3

We are very afraid that when the time will force us to move on 5.2 (because iOS update or anything unsupported in 5.1) the game will be unplayable.

The FontCache is still taking so much time, and my popups freeze at least 3 or 4 seconds on phone on 5.2, when it’s instant in 5.1.
I’m terribly disappointed that after 6 or 7 patches, the problem is still here, and it’s huge. I think I will upload to you our 3Gb project, it’s my last solution.

Thanks a lot.

Hi again,

We sent the whole studio project, issue bug #735927 on fogBuzz. I may be forget to mention it in the bug but you’ll need to play a bit (at least the tutorial) to open some menus, and you may need to build on Android to see the freeze.

And you can use our project to test everything you want, I think this is important for you to test your bugs on a big project and well, we share ours to you, you can do every test you want, even not related to my case.

Hope you’ll find this post and our project, if you see that the cause is a bad practices, feel free to contact me or post in this thread. Thanks !