Performance spike on Canvas.SendWillRenderCanvases when moving a panel

same bug here as @georgeq with a Windows 32 bit standalone build made with 5.2.1f1. The profiler spikes look the same to me.

Here is the android issue tracker:

In my case, I tried by disabling pixel perfect but sometimes SendWillRenderCanvas fill about 70-90% yet. I solved it by switching my font from dynamic to static (I have so much UI Text with same dynamic font but different sizes and animated fontsize with code in some texts).

Now with a static fontsprite the SendWilLRenderCanvas fills just 3%. I suppose the spritefont texture was being recalculated each frame.

3 Likes

Started happening here too, after upgrading to 5.2

As you can see it’s 1500 miliseconds, and when I expand it I see Font.CacheFontForText…
There’s this thread that talks about it, but weird thing is it didn’t happen before 5.2:

Anyone?

1 Like

Update:

Upgraded to the latest patch 5.2.1p2, and I thought I saw some improvement at first, but as you play the game longer it gets worse and worse…

For now I had to downgrade back to 5.1.1 and the problem no longer occurs. I hope they fix it in a coming patch.

1 Like

5.2.1p3 is out now, I wonder if it helps?

Hmm, I don’t see anything related to this in the release notes, but will give it a try.

I’d like to turn pixel perfect off, but it makes my text look terrible. How do you make text look good without it?

We’re seeing 70ms spikes in Canvas.SendWillRenderCanvases in PC standalone builds made with 5.2.1p3 and 35ms spikes with 5.1.1f1. Any pixel perfect canvases are disabled in this case.

Can someone shed some light on what asset issues can cause these spikes? Is this a “too many drawcalls” situation, or something entirely different? What does this Canvas method do?

I got the same issue, Unity 5.2.1f1. I disabled my UI elements one by one until I finally isolated what seems to be the source.

I have a Quick Slot menu displayed in the bottom of my screen (similar to weapon, spell and item quick use in Dark Souls) and my Text elements have a Shadow Script attached to them. Just by disabling those, the GC Collect spikes vanished with them.

EDIT: I investigated a bit more and found that I was changing the alpha of my text element through code, and that I was passing a NaN value. I fix the issue so it always assign a correct number and that removed the spikes too. So it was not directly the Shadow script that was causing this.

I got same issue, Unity 5.2.1p4 (Windows Editor and iOS builds).
I’m using UI mask. After I disable them spikes disappear, but it’s not an appropriate solution for me (

What is inside your mask? And how many elements? I have UI Mask as well, around 100+ buttons in it (it is a list view) and it does not take too much processing.

I have one Tiled Image inside mask. Size of image bigger than mask area - in this case I can change image position continuously, and it looks like it scrolls down endlessly, but in real after a small scroll down image “jumps back” on size of pattern, and user doesn’t see this.

I have somewhat the same too. I made a “compass” à la Skyrim. 4 images, North South East West and they scroll. When one is too far, let say to the left, I move it back to the right. But I does not have performance issue for that specific feature.

According to this post, the bigger the image, the more likely it is to have the performance issue. What’s the size of your image?

Image size is 32x32 pixels, masked area is 1024x312 (and it fits device width), tiled image is 896x1122.
So yeah, I can’t say it small, but in 5.1 it was giving a smooth result.
Also I change alpha via Color property. Interesting, changing of image Color could affect performance? I mean, does UI shader use Color parameter in any case, or only if it is different from default value…
Also, maybe it’s better to use simple bigger image with all pattern instead of using tile algorithm?

When you change the alpha by Color property, you are doing something like this right?

Color tempColor = myImage.color;
tempColor.a = targetAlpha;
myImage.color = tempColor;

I dunno if Color trigger the GC Collect. I personally have made a extension method for Graphics that uses a static Color property. This make changing alpha (or color) of a Graphic component much more elegant. And this avoid me to declare a tempColor every time.

2 Likes

No, I mean, I change it from his default value in Editor (I don’t change it in runtime). In this case I can do this in Photoshop. But, I don’t think this has any matter - UI shader must use it in anyway - changed or default it’s used in calculation, I guess.

Well, in that case it would surprise me that using a different color could cause the problem.

If you’re seeing these spikes, can you share some info on what type of canvas you’re using? (screen space overlay, camera, world space) and what type of movement is triggering it?

Our worst case right now is with a screen space overlay canvas and changing the sibling order of the UI elements below it to resort. In 5.2.2p1 we get 60+ms spikes in Canvas.SendWillRenderCanvases. The elements do contain masks, unfortunately.

thanks man!!! YOU SAVE ME !!!

Thanks man.You save a game 0 0、