- Home /
Scrollrect bad performance with Unity 4.6 on Android
Hello everyone, I'm using unity 4.6 to develop an application using Vuforia SDK. The app uses the cloud recognition feature of the SDK which means that the camera and some internet threads are working in the background. Also the app has a menu developed in it that will pop up when button is pressed. The menu contains a 2 separate panels each with a scroll rect and each scroll rect has a number of images that are downloaded using the WWW class using coroutines (3 downloads at a time).
However, when I test my app on my Android phone, the scroll rect react very poorly. Sometimes it respond to my touch and sometimes it doesn't. I tested it a couple of times trying to reduce the number of threads and the performance was better but still far from the native feel and its very noticeable that its not responding well.
Is there someway I can improve the performance? Has this issue faced anyone here before? if so, how did you fix it? Is there any different approach to this menu than simple Canvas and scroll rects?
Thanks.
Update
I have cleaned my project and removed all the gameobjects that are not needed and reduced the WWW coroutines to two at a time. I have also implemented a frame per second (fps) counter to measure the performance. While the Camera is on and the augmentation is ongoing, the fps measures between 33 fps to 45 fps. But when I open my menu the fps drops down between 23 fps to 28 fps.
I'm using a Samsung SIII mini with 1GB of RAM and a CPU 1 GHz dual-core Cortex-A9.
Are these states good or bad?
Update 2
I have tested the app on different (more powerful) devices and the fps registered almost always over 45 fps even if the Menu is opened. However the scrollrect performance isn't respond well. Maybe this issue is not really related to the performance of the App?
Update 3
I have just implemented another testing script on my app. It uses the OnBeginDrag event to trigger a counter to show if the "touches" are being registered or not. almost 95% of all touches have been registered but about 50%-70% of the time, the scrollrect doesn't get dragged up or down.
Answer by Bilelmnasser · Jan 19, 2017 at 10:03 AM
Canvas.pixelPerfect=false pixelPerfect bad with moving objects , especialy scroll rect
This solved my issue! Pixel Perfect does not work well with scrolling, just un-check the box in Canvas.
Answer by phil_me_up · Dec 24, 2015 at 01:42 PM
I seem to remember ScrollRects not performing well in version 4.6. They're still not fantastic, but are better in version 5.x
A few things you can do to help:
Avoid using ContentFit if you can. If you need to dynamically re-size the box to hold the content, then do it programatically
Try and make sure that you don't have overlapping RectTransforms. I personally haven't seen evidence of this improving performance, but I know it has been talked about so worth double checking
Simplify what's in the scroll rect.
Implement your own scroll rect. If you just want basic behaviour, you can implement your own system without too much trouble.
If responding to touch is the problem, look at where your canvas / graphic raycasters are. I remember having some difficulty with some components stealing input, making it difficult to actually scroll the box. If could be fixed by re-arranging / adding these components in key areas, but it wasn't very pretty.
Thanks for your answer phil_me_up.
I have just implemented another testing script on my app. It uses the OnBeginDrag event to trigger a counter to show if the "touches" are being registered or not. almost 95% of all touches have been registered but about 50%-70% of the time, the scrollrect doesn't get dragged up or down.
I will try and test this on Unity 5.x versions and see if their is any change and will update the question.
You should find that things improve a bit as the input priority system was altered in Unity 5, but it might not automatically fix everything...
Your answer
Follow this Question
Related Questions
Overhead spike of 46.2ms when profiling on Android!!! 1 Answer
Screenshot function not working properly ,it records button on UI ? 0 Answers
Expansion/Database help 2 Answers
Android Low FPS 2 Answers
Animation are not fluid in android 1 Answer