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.


Messages - Phong

Pages: [1]
1
NGUI 3 Support / Re: Scrollbar Foreground image scaling
« on: January 17, 2013, 06:07:53 PM »
I looked at the code for UI scrollbar and noticed that the foreground is scaled to fit inside the "center" slice of the background sliced sprite. So if your scrollbar is vertical and it is a sliced sprite with borders specified for the left and right. The foreground image will be squashed horizontally to fit in the center slice. One solution is to set the left and right borders to zero for the background for a vertical scrollbar and set the top and bottom borders to zero for the background for a horizontal scrollbar.

2
Thanks! that was it. Explains why the widgets weren't being counted as well.

3
I am trying to make a soft clipped scrollable panel. I followed the steps described here http://www.tasharen.com/?page_id=4444 carefully, except I didn't use the UIGrid and I am creating the objects under the soft clip panel with a script.

If I use a prefab to create the children of the soft clip panel then clipping doesn't work (I also notice that the UIPanel also does not report the new widget children in it's numWidgets field). If I build the widget by creating an empty game object and AddComponent(UILabel) then clipping does work. The labels labels created using each method are absolutely identical in the inspector (same layer, name, position everything) but one is clipped and one isn't.

Here is the code I use to create the NGUI objects (doesn't work):

            GameObject rowGO = (GameObject) Instantiate(listItemPrefab);
            rowGO.transform.parent = PanelSoftClip.transform;
            rowGO.transform.localPosition = new Vector3(0f,(float)rowY,0f);
            rowGO.transform.localScale = Vector3.one;

Is it O.K. to add widgets to panels like this? Should I be using the NGUI API?

Thanks.


4
NGUI 3 Support / Best Practices for Atlas Switching
« on: June 25, 2012, 11:53:02 AM »
I watched the video on atlas switching and searched the forums but I still have a few questions. Here is my setup

AtlasRef
AtlasHD
AtlasSD
FontRef
FontHD
FontSD

Question 1 Which atlas should the FontHD and the FontSD reference? Is it OK for them to reference the AtlasRef?

Question 2 What is the best approach for creating the SD atlas and fonts? I tried:
  • Creating the HD atlas first
  • Duplicating the HD atlas prefab, material and png to create SD atlas
  • Shrinking the copied png to half size and updating the references in the SD material and prefab
  • Also duplicated the HD font and pointed the the copy to the SD atlas but it didn't work so I created an SD font from scratch and added it the the SD atlas
Is there an easier or better approach for creating the SD atlas?
Is it dangerous to create atlases by duplicating an existing atlas instead of using the atlas maker?
Is there an easier way to create smaller fonts or fix a font's reference in the atlas?

What is the best way of doing this?

O.K. Way more than two questions. Advice would be very much appreciated thanks!

Pages: [1]