Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Performance issues on android with Scrollrect

Discussion in 'UGUI & TextMesh Pro' started by GrandWaazoo, Dec 8, 2014.

  1. GrandWaazoo

    GrandWaazoo

    Joined:
    Mar 2, 2014
    Posts:
    22
    Hello,

    I'm using the new ui to develop a chat system in my game. I want to have something like facebook app messenger. For now Im using a scrollrect with a vertical layout group, and I just push new message in this scrollrect.

    I have big problems of framerate on android by using this system. If I add more than 10 messages, the app begins to slow down. So for a chat application, this is not viable.



    Do you have some ideas why is it so slow ? Or any ideas to cope with this problem ? I can't use the profiler of unity because Im on the free version.

    Im using Unity3D 4.6.0p1

    Thank you.
     
  2. BMayne

    BMayne

    Joined:
    Aug 4, 2014
    Posts:
    186
    Hey there,

    Are you using best fit on your text with a dynamic font?

    Regards,
     
  3. GrandWaazoo

    GrandWaazoo

    Joined:
    Mar 2, 2014
    Posts:
    22
    Hey,

    No Im using a simple text component like this :
     
  4. GrandWaazoo

    GrandWaazoo

    Joined:
    Mar 2, 2014
    Posts:
    22
    I profiled the fps in game. With 40 messages, if I don't move in the scrollrect im at 60 fps on android galaxy s4 mini. If i slide the scroll rect with my finger , the game fall to less that 10 fps. So maybe its the way I built the scrollrect :
     
  5. GrandWaazoo

    GrandWaazoo

    Joined:
    Mar 2, 2014
    Posts:
    22
    Hey, i finally get unity profiler to see more precisely what happened. When I don't touch the screen it stays at 60 fps, and when I scroll down or up the fps falls to less than 15 fps. The canvas.BuildBatch function is very slow at this moment. Look the graph :




    I tested with 10 or 40 messages, the performance stay the same for the both cases. So its really weird...
     
    Last edited: Dec 9, 2014
  6. vrm2p

    vrm2p

    Joined:
    Jul 23, 2014
    Posts:
    17
    I think this is a great issue at the moment, which makes the ScrollRect completely useless for any lists with more than 10 children.

    Here's another profiler from my desktop slowing down to 15fps



    on android:

     
  7. Raimis

    Raimis

    Joined:
    Aug 27, 2014
    Posts:
    160
    Maybe Unity guys will say something to this thread. I believe it's ~5th thread with the same performance problem.

    EDIT: according to sustained development plan, this week we should receive a 4.6.1 update. Maybe they will address these issues in the update as well. Given new features are not being added right now (please correct me if i'm wrong), I would expect that the focus is on polishing current features and performance of scroll rects hopefully among the items on the priority list (followed by text component :)). I understand that performance of scrollrect is only reflection of the problems under the hood (too many calculations), but this comp is used by so many and I expect this to be fixed eventually.
     
  8. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,281
  9. vrm2p

    vrm2p

    Joined:
    Jul 23, 2014
    Posts:
    17
    tried again with the 4.6.1 version, the results are the same as before:

    desktop


    android

     
  10. Raimis

    Raimis

    Joined:
    Aug 27, 2014
    Posts:
    160
  11. GrandWaazoo

    GrandWaazoo

    Joined:
    Mar 2, 2014
    Posts:
    22
    I applied the new version. I changed nothing on the project and the performance problems were the same. I restart from zero the scene, and now the performance are stable at 60 fps with 10 or 50 elements. I compared with my old scene, they are identical. So I don't really understand why it works better now ....
     
  12. paradizIsCool

    paradizIsCool

    Joined:
    Jul 10, 2014
    Posts:
    178
    Have you tried to clear the Library and Temp folder before making a new test with the "old" scene ?
     
  13. vrm2p

    vrm2p

    Joined:
    Jul 23, 2014
    Posts:
    17
    yep, everything was rebuilt. still 15frames
     
  14. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    HI, we are actively targeting performance issues right now. If you log a bug with teh project we will look at the root cause and attempt to fix this issue.
     
  15. dungmv

    dungmv

    Joined:
    Apr 9, 2015
    Posts:
    6
    I also have the same issue. someone have any idea?
     
  16. Agent_007

    Agent_007

    Joined:
    Dec 18, 2011
    Posts:
    899
    Basically you need endless/infinite scrolling. It just isn't possible to adjust positions, check clippings etc. for 100 of elements without performance penalty. And that is what current scroll list is trying to doing for mobile platforms and naturally it won't work.

    Best thing would be that Unity devs would implement endless/infinite scrolling. There something like that in NGUI
    http://www.tasharen.com/ngui/docs/class_u_i_wrap_content.html
     
  17. dungmv

    dungmv

    Joined:
    Apr 9, 2015
    Posts:
    6
    So I should use ngui?
     
  18. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    852
  19. Benjaben22

    Benjaben22

    Joined:
    Oct 26, 2012
    Posts:
    75
    I would be interested in this plugin if it provided source code and supported horizontal menus
     
  20. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    852
    not yet. and the source is not provided, sorry
    EDIT 27.08.2016: happy to announce V2.0 is out, improved and with horizontal scrolling support: http://u3d.as/xXQ
     
    Last edited: Aug 27, 2016
  21. qiankanglai

    qiankanglai

    Joined:
    Jun 8, 2013
    Posts:
    22
    I've implemented something like infinite scroll, and hope you're interested

    https://github.com/qiankanglai/LoopScrollRect/
     
  22. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    852
    happy to announce V2.0 is out, improved and with horizontal scrolling support: http://u3d.as/xXQ