Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - cheuksh

Pages: [1]
1
NGUI 3 Support / Pic does not show up after mainTexture assigned.
« on: April 25, 2014, 09:17:02 AM »
If I click the button, the texture show.
But if I change the PicReady from its own class, the texture not show....

Is it any hidden function inside the OnClick event that need to update or redraw the pic. Any other function I need to call if I update the texture outside the on click event?


  1.         public UITexture uiTexture;    
  2.         public MyPicPick MyPic;
  3.  
  4.         void Start() {
  5.                 StartCoroutine(UpdateImage());
  6.         }
  7.  
  8.         void OnClick() {
  9.                 NGUIDebug.Log("Call From On Click");
  10.                 MyPic.PicReady = true;         
  11.         }
  12.  
  13.         public void ChangePicReady() {
  14.                 NGUIDebug.Log("Call From Other");
  15.                 MyPic.PicReady = true;
  16.         }
  17.  
  18.         IEnumerator UpdateImage() {
  19.                 while (true) {
  20.                         yield return new WaitForSeconds(4);
  21.                         if (MyPic.PicReady) {                          
  22.                                 string url = "file://" + PlayerPrefs.GetString("PicPath");
  23.                                 WWW www = new WWW(url);
  24.                                 yield return www;
  25.                                 uiTexture.mainTexture = www.texture;
  26.                         }
  27.                 }
  28.         }

2
NGUI 3 Support / ClipRange Dislocated After moving the panel...
« on: January 15, 2014, 02:38:50 PM »
I have a vertical scroll view with about 200 item, when user scroll to item 160-180, clicked a back button, changed their location, all of the scroll item are then removed and another 200 items are added from the database. Everything work smoothly.

However, all item disappear from the screen..I checked the scrollview, it is find that the scrollview is still in its old position (at item 16(making item 1-20 far away from the screen) ...so I reset it mannually:
  1. ScrollViewGO.transform.localPosition= new Vector3(ScrollViewGO.transform.localPosition.x,OriginalScrollViewY, 0);
now the location is correct but I still cannot see the item and I find that the clip range positions is moved....I think it is not the good way to reset like this....

Is it anyway to easily reset the scrollview, once all the items inside are replaced by a new set of items?

3
NGUI 3 Support / UITexture Memory Leak
« on: January 08, 2014, 08:11:11 PM »
  1. UItextureGO.material.mainTexture = www.texture;
  2.                         ScrollViewGO.GetComponent<UIPanel>().Refresh();

I have a 1000 row each row have a UITexture downloaded from internet.
Of course I wont make a 1000 scroll item, instead, I only made 20, I will reposition them, reuse them, when user rolling the scroll view. so item 1 will beceom item 21...item 2 become 22, when scrolling down. It will fine.
But I find that, when I keep scrolling down the memory keep rising up..to 2.0GB and crashed unity....So I guess the uitexture replaced still inside the memory event a new www.texture is assigned...
I tried Resourced.UnloadAsset..but it seems it cannot unload a texture, it can only unload a gameobject...Since the gameobject is to be reused and cannot be destoyed.....

4
NGUI 3 Support / How to adjust size of a background to fit its chidren?
« on: January 04, 2014, 05:12:31 PM »
I have a background (UISprite), which have two children, one is call title (UILabel) another call paragraph (UILabel).
Because the paragraph have multiline, the height is varied. How can I adjust the height of the background to fit this? I tried UIStretch, but it only allow resizing the background according to one child object but not all children.
Because this background is an scroll item inside a scroll view. The height of the background will be used to make all of them position correctly in a scrollview. So I cannot simply separate the background for title and paragraph......

5
NGUI 3 Support / vertical scrollview with 1000+ row item
« on: December 30, 2013, 01:09:26 PM »
Is it anyway to do a scrollview with many roll?
With a normal clipping panel, without any alteration, my fps is 10....

Plan A Automatic recycle of scroll item
Plan B Use occlusion culling
Plan C Inactive some of the item according to their postion
Plan D change the background of the sprite from UIsprite to something lightweight, such as simple background color


Plan A require manually recalculate the position of the row on the fly..which is complicated
Plan B tried, wont work.
Plan C....I find that if I set inactive for those row which is outside camera can raise the fps....
Plan D..it seems I cannot apply a background color without applying a UIsprite....

Any suggestion?

6
in UISprite, the drawing dimension is read only.....
Actually not just the dimension, it is very common for us to change attribute of a widget by code,  such as depth, pivot, color,atlas, sprite, sprite type, fill center etc.

Is there any where I can find information of how to change them by code?

<suggestion>
It would be nice to have such feature added. as I find a lot of user here is looking for change those value.
For my case, I spent 2 hours, from documentation, script, forum, google, and cannot find a way to change those value on the fly. So it would be very great if Ngui have a mode that when I change any value, Ngui will tell me what is variable is changed, and how can I get it changed by code as well. If this is not possible write a remark of each field in the editor to how to change that value by code. If no possible write it in the help file, so that I right click on the widget click help, then I know how to adjust those value....
very much appreciated.


7
NGUI 3 Support / scroll view not showing row item when scroll
« on: December 18, 2012, 08:42:52 AM »
I uploaded the bug to here: URL REMOVED
You can see there is nothing by just a clip view. When scrolling upward to a certain point, all item disappear.
The problem scene is called Nugi Slider Bug.

8
NGUI 3 Support / Raycast cannot be detect at the edge of the camera
« on: May 06, 2012, 02:09:09 PM »
End up all event, including press,click, hover is not working for the button at the edge, attached two screenshot. With the button 0 hover effect set to flat outline. u can see screenshot 1 when the mouse is near the edge of left hand side, raycast cannot be detected..while, when I move the mouse a little right, hover can be detected. (The screen capture cannot capture my mouse cursor, I add them back by photo edit. So just neglect the little color difference near the cursor, it just for indication purpose.) When I built it, button 0,4,5,9 cannot be pressed...

9
NGUI 3 Support / weird behavior on android device
« on: May 06, 2012, 04:56:38 AM »
To replicate, simply add a new ui, add a new label in the panel. It works and look fine in the unity game preview, but if you build and run in a real device, the screen seems duplicated (tiled) automatically. (see my screenshot)

Please notice even the wording development build is also "tiled"

10
NGUI 3 Support / How to add item to the scroll list by code?
« on: April 13, 2012, 07:51:44 AM »
normally data are from other source or service and have to dynamic add to the scroll list item....May I know how to do? Thx a lot

11
My app will download user photo from the web and use as their avatar image, in this way, I can do preset in unity, as must done by code? How can I do it? Any example? How should I start with?


Pages: [1]