Author Topic: NGUI 3.8.2 UITexture Flicker  (Read 3040 times)

vincentmmc

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
NGUI 3.8.2 UITexture Flicker
« 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;

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI 3.8.2 UITexture Flicker
« Reply #1 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.