Support => NGUI 3 Support => Topic started by: Simie on November 24, 2013, 06:39:30 PM
Title: Flickering Issue
Post by: Simie on November 24, 2013, 06:39:30 PM
3.0.6 rc3
Video: https://www.youtube.com/watch?v=J_xHKkpDBw8 (Can be hard to see the flickering, since it looks like an artifact of the video itself)
Whenever a widget changes parent, or some other change occurs which causes panels to be refreshed, all the widgets on-screen will disappear for a frame or two before reappearing. This is especially noticeable on iOS, where the refresh seems to take much longer, but also occurs on standalone builds. It doesn't occur in the editor, and doesn't occur anywhere when using 3.0.5. Panel refreshes also seem faster pre-3.0.6.
I also had to manually call UIPanel.Refresh() at times, since it doesn't seem to detect changes in alpha correctly sometimes in 3.0.6. In the video above, the times Panel.Refresh() is being called are when the character cards are pressed and they begin to expand towards the centre of the screen, tweening their alpha from 0.0f -> 1.0f in process, the new alpha value doesn't seem to take effect unless I do something like this before the tween begins:
ContentsPanel.alpha= 1.0f;
ContentsPanel.Refresh();
ContentsPanel.alpha= 0.0f;
I can provide more detail if needed.
Title: Re: Flickering Issue
Post by: ArenMook on November 24, 2013, 06:57:30 PM
Do you call UIWidget's ParentHasChanged() to notify them when you reparent them? Refreshing the panel shouldn't be necessary, especially for alpha stuff. Alpha property takes care of marking it as dirty which will cause a refresh on the next update. Perhaps it's related to when you're doing it?
Title: Re: Flickering Issue
Post by: Simie on November 24, 2013, 07:09:29 PM
Here is a video of the alpha bug: https://dl.dropboxusercontent.com/u/3077939/Game/Bugs/alphabug.mp4
That's without the Panel.Refresh() code above before tweening the alpha to 1.0f
I'm using NGUITools.MarkParentAsChanged on the objects which change panel. But the flickering seems to occur whenever the panel refreshes, not just when I call the ParentHasChanged. (And again, it also didn't happen on 3.0.5)
Title: Re: Flickering Issue
Post by: Simie on November 24, 2013, 07:21:46 PM
Here is a video of the alpha bug: https://dl.dropboxusercontent.com/u/3077939/Game/Bugs/alphabug.mp4
That's without the Panel.Refresh() code above before tweening the alpha to 1.0f
Just to add a bit more to this, I just noticed in the video that while I was adjusted the alpha of one panel, another panel's alpha was increases/decreasing. (I definitely had the correct panel selected in the inspector, I can reproduce this 100% of the time). It seems that the draw call for the panels get swapped/orphaned somehow.
Edit: Another video https://dl.dropboxusercontent.com/u/3077939/Game/Bugs/alphabug2.mp4
Video of flickering issue on the iPad: https://www.youtube.com/watch?v=NIOftoElfgo
Title: Re: Flickering Issue
Post by: ArenMook on November 24, 2013, 10:26:21 PM
The only thing 3.0.6 does differently I can think of is that the panel alpha is now cumulative. This means that parent alpha affects all of the child panels as well.
Title: Re: Flickering Issue
Post by: beermoney on November 25, 2013, 06:05:13 AM
I also am seeing the same issues with 3.0.6 rc3
appears to work fine in the editor but in release builds (stand alone and web player - I've only checked these) I'm seeing components disappear and for a lot longer than a couple of frames too
Title: Re: Flickering Issue
Post by: Antti on November 25, 2013, 06:34:43 AM
We too experience the UI flickering on 3.0.6 rc3.
Based on some quick testing, flickering seems to be connected to frames when UIDrawCalls are being destroyed and constructed on UIPanel.LateUpdate(). Perhaps when the LateUpdate() is doing full rebuild of UIDrawCalls?
I just guessing here a bit to help.
Title: Re: Flickering Issue
Post by: PebbleBug on November 25, 2013, 11:16:05 AM
I'm also seeing flickering on iOS now that wasn't there before.
E.g. there is flickering when activating or deactivating components by using SetActive(true/false). However, when I change the alpha to 0 or 1 instead, there is no flickering. (not entirely sure SetActive(false) causes a flicker though)
Best, Jakko
Title: Re: Flickering Issue
Post by: romeo_ftv on November 25, 2013, 01:19:04 PM
the same issue after update to 3.0.6rc3
Title: Re: Flickering Issue
Post by: robrjames on November 25, 2013, 05:29:55 PM
I just upgraded to 3.06 and now I'm seeing flickering. I was using the previous version yesterday and this wasn't happening. I'm seeing it on iOS builds. I don't notice it in the editor.
It's happening only on those UIPanels where I activate their gameobject. (game object with the panel I have initially disabled).
So I guess a work around would be to have everything enabled off screen and pop / move them into the camera view when needed.
Title: Re: Flickering Issue
Post by: ArenMook on November 25, 2013, 06:21:47 PM
I will investigate and fix this tonight.
Title: Re: Flickering Issue
Post by: kofight on November 25, 2013, 09:37:22 PM
Flickering on android devices too
Title: Re: Flickering Issue
Post by: boofcpw on November 26, 2013, 01:42:04 AM
I am having this issue on every ios device I have tried (not in the editor). It also happens when building the example scenes. If it helps, I am adding widgets to the panel at runtime, which appears to break everything pretty badly. This was not an issue until recently. Hopefully this can be solved as soon as possible :)
Title: Re: Flickering Issue
Post by: ArenMook on November 26, 2013, 03:09:17 AM
I just put up 3.0.6f2 with a fix for this issue. If you still encounter it, just let me know (I'll likely need a repro case).
Title: Re: Flickering Issue
Post by: boofcpw on November 26, 2013, 03:21:14 AM
You are fantastic :D
Title: Re: Flickering Issue
Post by: PebbleBug on November 26, 2013, 03:54:55 AM
Yes, fixes the flickering issues for me. Thanks.
Title: Re: Flickering Issue
Post by: kofight on November 26, 2013, 03:56:39 AM
Fixed, thanks ;)
Title: Re: Flickering Issue
Post by: ArenMook on November 26, 2013, 04:05:41 AM
Unfortunately in the process I broke something else <_<
...so I just re-uploaded f2 with a fix for that. Readme wasn't updated anyway.
Title: Re: Flickering Issue
Post by: Antti on November 26, 2013, 10:04:38 AM
This is still an issue for us (maybe we are doing it wrong ;)). It looks like the whole UI flickers sometimes. Everytime I have encountered flickering, the following happens:
Frame n: UIPanel.Find() is called, mRebuild is set to true, and full draw call rebuild is triggered on LateUpdate().
Frame n + 1: All UI widgets are missing.
Frame n + 2: All UI widgets are visible, but some are ill-positioned (centered).
Frame n + 3: All UI widgets are shown properly.
This happens on both editor on PC and on iOS devices, so I guess it's not platform dependent. I have tested with the latest version 3.0.6 f3 on Unity 4.2.2.
Title: Re: Flickering Issue
Post by: beermoney on November 26, 2013, 10:10:06 AM
3.0.6.f3 resolved the flickering issues I had
I know the asset store had 2 versions of NGUI on earlier, might be worth checking it wasn't a botched update?
Title: Re: Flickering Issue
Post by: Antti on November 26, 2013, 10:57:52 AM
Re-downloaded and re-imported NGUI, I have the latest version for sure.
Title: Re: Flickering Issue
Post by: ArenMook on November 26, 2013, 11:13:26 AM
I can use a repro case, Antti.
Title: Re: Flickering Issue
Post by: Simie on November 26, 2013, 03:32:41 PM
That's the flickering resolved for me, thanks Aren. The alpha stuff still happens, but my workaround works fine for that.
Title: Re: Flickering Issue
Post by: boofcpw on November 26, 2013, 06:03:08 PM
Got the latest update. Can confirm it fixes all my issues. Thanks so much for that fast fix!
Title: Re: Flickering Issue
Post by: boofcpw on November 27, 2013, 01:08:14 AM
I appear to be getting occasional flickering (nothing like before where the whole panel would break) when I turn on/off a widget using setactive(). Im not entirely sure if this happened previously or not, but I feel like I haven't seen it before. It only happens for what appears to be a single frame.
Title: Re: Flickering Issue
Post by: Antti on November 27, 2013, 02:26:14 AM
We got our issue solved.
We had a bug in our code: we occasionally created a widget under a wrong parent, having no panel in the ancestors of the UI hierarchy.
(Thanks for the latest performance optimizations btw! We appreciate them a lot :))
Title: Re: Flickering Issue
Post by: ArenMook on November 27, 2013, 03:35:06 AM
If you have any "before" and "after" profiler screenshots, I'd be very curious to see them :)
Title: Re: Flickering Issue
Post by: Antti on November 27, 2013, 06:15:15 AM
Here are profiler screenshots from the same scene, first with NGUI 3.0.4, then with 3.0.6 f3.
There where other changes than NGUI version between those builds too, e.g. the spikes you see in 3.0.4 are gone because of those.
But AFAIK the CPU time difference 2.32 -> 1.22 and the absence of memory allocations should be directly contributable to NGUI optimizations.
Title: Re: Flickering Issue
Post by: ikuniojp on November 27, 2013, 07:28:09 AM
On 3.0.6f4.
I have flickering problem too... But mine happen when the scene toggle. Just a quick flick but annoying.
Title: Re: Flickering Issue
Post by: freeExec on December 12, 2013, 09:34:12 AM
Between OnEnable Update and where they anchoring succeeds sprite render one frame. It is necessary to add a forced binding while OnEnable.
UIWidget.OnEnable() +UpdateAnchors();
Title: Re: Flickering Issue
Post by: boofcpw on December 16, 2013, 10:21:33 PM
Id just like to confirm that the latest update has solved the other issue I was getting with widgets flicking when being turned on/off. Thanks for that :)
Title: Re: Flickering Issue
Post by: freeExec on December 17, 2013, 12:47:09 AM
How correctly to should on the panel through gameObject.SetActive(true) or NGUITools.* ?