2

In my game, I have a scrollrect which its content have a VerticalLayout component. When I fill that with so many count of GameObjects, the game will fall in problem!

My list has more than 300 GameObjects.

How to optimize my scroll list?

sma6871
  • 3,198
  • 3
  • 38
  • 52
  • "*the game will fall in problem*" you need to be more specific about how it is failing for us to be able to help you fix it. – Scott Chamberlain Aug 05 '16 at 18:58
  • @ScottChamberlain a list with more than 300 game objects will cause leak memory. I have to create just game objects that show in pane and simulate scroll, but i don't know how to do that. – sma6871 Aug 05 '16 at 19:55
  • Please show the proof that you found that putting 300 objects in the list causes a leak [as a edit to your question](http://stackoverflow.com/posts/38795637/edit) – Scott Chamberlain Aug 05 '16 at 20:05
  • @ScottChamberlain Memory leak is happen in android and ios devices. In windows there is no problem. – sma6871 Aug 05 '16 at 20:13
  • 1
    Again, **show your proof**. For example [you can attach the profiler to an android or iOS device](https://docs.unity3d.com/Manual/Profiler.html) and show the leak happening there. Take a screenshot and put it in your question. Without it you are unlikely to get any answers. – Scott Chamberlain Aug 05 '16 at 20:15
  • @ScottChamberlain [This is](https://www.youtube.com/watch?v=FOQV8AA50Rw) my problem and what I want to know – sma6871 Aug 05 '16 at 21:23
  • That is not a memory leak, that is a performance issue from having many objects. Why don't you do what the video says and pay the $5 and download [the asset package](https://www.assetstore.unity3d.com/en/#!/content/58158) that does it for you. – Scott Chamberlain Aug 05 '16 at 21:26
  • @ScottChamberlain Because its a dll and I don't know Is it work for me or not! – sma6871 Aug 05 '16 at 21:54

1 Answers1

2

I solved my problem (Performance issue, as Scott Chamberlain said) by do some tips in Optimising Unity new UI System Article.

Disabling pixel perfect is very useful tip that works for me:

  • ScrollRect will rebuild / reload everything every frame if pixel perfect is enabled.
  • Canvas PixelPerfect has large performance impact. Disable it if possible.

Another useful tip:

  • Disable gameobject when off-screen
Community
  • 1
  • 1
sma6871
  • 3,198
  • 3
  • 38
  • 52