Hi, I have a list made with a ScrollRect and about 30 items inside, each of which is a Panel with a couple of images and texts, all done using the new Unity UI system. However scrolling is incredibly slow, especially on mobile devices, when profiling that’s where the issue seems to be:
Canvas.SendWillrenderCanvases
which takes up to 8ms per frame. So am I doing something wrong? Or is that just a limit of the current UI system? I’m using Unity 4.6 RC3
I’ve been actually digging more into the profiler and I found out that using SetActive() on a gameObject that has several UI elements as children is incredibly slow, the aforementioned UI set takes up to 160ms (!!!) when I switch on/off that list. How is that possible? Shall I just give up and find a workaround? I’m honestly a bit sad about the performances of uGUI so far, I was expecting to be more performant comparing to other GUI tools available on the Asset Store. I hope it’s just me making some improper use of the whole system.
I have had the same experience… performance is horrible. So far it looks like any activating or moving of the RectTransforms is the cause of the lag. I suspect it is because the canvases are using raycasting which means UI elements must have colliders and moving colliders around strains the physics engine which tries to keep track of all of them.
My workaround for setactive is to have seperate canvases for each view and changing the render layer of the canvas. This way you can stop drawing whats not needed without deactivating
As for scrolling - I am experimenting with a second camera as moving the camera does not change the position of the actual RectTransforms… we’ll see how that goes… I will also try to just move the canvas and see if that triggers a physics lag.
I did find some UI performance problems as well. I created a simple test project that is demonstrating the problem, along with a description that explains what I try to accomplish and additional performance measurement findings.
I sent this as a bug report to Unity, a week later they fixed the issue.
I suggest, rather than giving up, do the same and let Unity know about this issue.
Any luck? I tried it out and the performance is much better, but I haven’t manage how to render a small part of a canvas from another camera source. I have a panel layered on top of the screen. Inside of it I want to display a scrolling list of message items (2 text labels) that will function as a chat.
I believe that NGUI have support for this, but in the Unity documentation it says that nested canvas will automatically share the same settings as their parent, and therefor cannot render something from another camera.
Hmmm. I found out that my problem had to do with a tiled UIImage that the centerpiece was too small. So the combination with a tiled background image (with a 4x4 tile image) and a scrollrect over it with multiple text items messed things up. Well, now it works much more reasonable.
It is complicated - you pretty much have to separate canvases and assign them different layers that are then culled by the two cameras. What I haven’t figured out yet is how to allow 2 canvases to work together in the same coordinate space and process inputs correctly.
The Canvas Group element seems to be the solution as it can stop canvases from blocking raycasts, but haven’t implemented it yet. That is my next lead.
Sorry for the late reply, I just missed all your posts guys, but FYI the problem was in the pixel perfect checkbox on the Canvas component. That makes sense since Unity will need to readjust all the UI items in the scroll list every time the ScrollRect is dragged. Unchecking it did dramatically increase the performances!