[5.2] major UI performance issues :(

Outline.ModifyMesh() is allocating insane amounts of memory (325k GC Alloc) and taking a whopping 18ms , previously on exactly the same project it was taking practically no time at all and not allocating memory…

Graphic.UpdateMaterial() is now allocating memory…?

The new RectMask2D is great, but again, using it is causing massive garbage collection as ClippedRegistry.Cull is allocating memory every frame.

Looks like a switch back to 5.1 for us until these problems are fixed, which is a shame as I’ve just spent a couple of days refactoring tons of OnFillVBO() stuff to use OnPopulateMesh() - massive waste of time!!

Profiler shots below, same scene 5.1 vs 5.2

1 Like

Take a look at the profile of the same scene, at the same point… 5.1 vs 5.2

The obvious one to notice is the insane memory allocation for OutLine.ModifyMesh(), but also notice Graphic.UpdateMaterial() is now allocating memory which is horrible when you have a fluid UI with lots of stuff moving around and animated, I’m getting 60+ calls to UpdateMaterial a frame on some of the more complicated animated UI’s.

It’s almost as if you guys setup a worst case single scene with millions of textboxes + buttons, refactored the entire UI code to make that specific scene perform better and then just released the code! Oh, wait… ( Unity Blog )


We will have a fix for this in a patch release soon.

2 Likes

Good news :slight_smile: Thanks Tim.

Turns out using the inbuilt Outline / Shadow effects is not such a good idea when you have a triangle mesh with optimal verticies anyway, the first thing outline does is destroy your optimized verts…

I’ve added native support for outlines and shadows into our ui extensions and everything is working extra funky, extra quick, with half as many vertices as unity 5.1 :slight_smile:

Have you checked the patch to see if it fixes the issue? 5.2.1p1

I can’t test in 5.2.1p1 as they handily changed the API for OnPopulateMesh() to use that god awful vertex helper class instead of a standard Mesh - they haven’t supplied any documentation or updated the UI Bitbucket source code either.

Nice work. Good luck beta testing 5.2 on your own guys. I’m not going near 5.2 again until they quit messing us around.

I can confirm the Outline/Shadow allocations are fixed in Unity 5.2.1p1, however, the CPU overhead for using Shadows / Outlines is now Criminal.

1 Like

Yep, the method Shadow.ApplyShadowZeroAlloc indeed doesn’t alloc any memory, but it takes a huge cpu overhead 8ms in an i7 for 20 texts with 6 short words each.

Can you submit a bug report for this? There might be something particular about your use case that we should investigate.

1 Like

Hey pfreese I have created a repo project and recorded a video here is the case number #784064.

Many thanks,

As you will see the problem is the RectMask2D which should be the cheapest way of doing mask

I’m having problems with shadows generating tons of garbage for no reason. Nothing was even changing on the screen.

In fact, everything in general just spikes badly every so often.