Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: sb_007 on November 22, 2017, 06:38:33 AM

Title: Lag in Scrollview Drag
Post by: sb_007 on November 22, 2017, 06:38:33 AM
When scrollview has , say, 50+ items, the drag gets dead slow on device & editor. But using "mouse scroll button" in editor, its as quick as bullet (which is fine).
Title: Re: Lag in Scrollview Drag
Post by: ArenMook on November 23, 2017, 01:31:50 AM
I can only suggest making good use of the Profiler to find the culprit. I certainly see no issues with this on my end, and I've had some long scroll views.
Title: Re: Lag in Scrollview Drag
Post by: sb_007 on November 23, 2017, 02:18:04 AM
I can only suggest making good use of the Profiler to find the culprit. I certainly see no issues with this on my end, and I've had some long scroll views.

I'm having 10 labels & 5 sprites on each element of scroll view. Labels have outline value of 1 & few sprites have gradient too.
Anything you could suggest for better performance.
Title: Re: Lag in Scrollview Drag
Post by: sb_007 on November 23, 2017, 03:56:02 AM
UIRect.Start() and UIRect.Update() shows 1500+ "Calls" in Profiler.
Fonts.CacheFontForText shows 5000 calls in Profiler.

Note: I have 4-5 anchored elements in the current screen. Having drawn once, the anchoring is Reset by me. Batches increase by 15 when this screen is SetActive.
Title: Re: Lag in Scrollview Drag
Post by: ArenMook on November 29, 2017, 08:19:19 AM
Anchoring sounds like your problem. That, and dynamic fonts. CacheFontForText is not an NGUI function, so I assume it's something to do with Unity's dynamic font system. Your anchoring causes things to move, which causes draw buffers to be marked as changed, which in turn causes draw calls to be re-created, which leads to rebuilding all of your text. There in lies your slow-down.