Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: vincentmmc on June 01, 2016, 02:02:10 AM

Title: NGUI 3.8.2 UITexture Flicker
Post by: vincentmmc on June 01, 2016, 02:02:10 AM
I made a product list by using NGUI 3.8.2 Unity 5.2.3.
When i change the product texture ,all textures are flickering.
The strange thing is sometimes it flickering,but sometimes not!
It's very hard to figure out,can someone help me?

Here is my hierarchy:
UI ROOT
--UIPanel
----ScrollView
------ItemGroup
--------Item1
----------UITexture
--------Item2
----------UITexture
--------Item3
----------UITexture

The item script:
  1. public class ProductItem
  2. {
  3.     public void SetData(ProductData param)
  4.     {
  5.          
  6.          //set name,set price...
  7.          ...
  8.          ...
  9.  
  10.          //set texture
  11.          StartCoroutine(LoadImage(param.url));
  12.     }
  13.  
  14.     IEumerator LoadImage(String url)
  15.     {
  16.         WWW www=new WWW(url);
  17.         yield return www;
  18.         if(www.isDone)
  19.         {
  20.              transform.FindChild("UITexture").getComponent<UITexture>().mainTexture=www.texture;
  21.         }
  22.     }
  23. }
  24.  

----------
I try to call UIPanel.Refresh() but it does not work;
Title: Re: NGUI 3.8.2 UITexture Flicker
Post by: ArenMook on June 01, 2016, 10:11:21 PM
You can force-update draw calls immediately using NGUITools.ImmediatelyCreateDrawCalls(widget.gameObject), where 'widget' is your UITexture.