- Home /
NGUI UIPanel and UIscrollviews
Hi everyone! i'm facing some strange issues with a menu i'm developing The situation is this
I have an UIPanel ( red stroke in the image ) that clips an area of 400x1476 as a child of this uipanel i have an UIWidget that i use for tweening. as child of this UIWidget i have two UIScrollviews that are one on the side of the other ( yellow stroke ). content of the scrollviews (green lines) are generated dynamically via code using this code
for (int i = 0; i < availableTextures.Length; i++) {
GameObject button = NGUITools.AddChild (subMaterialGrid, subMaterialbuttonPrefab);
button.GetComponentInChildren<MaterialData> ().setMaterialConfig (availableTextures [i]);
button.GetComponentInChildren<UILabel> ().text = availableTextures [i].description;
button.GetComponentInChildren<UILabel> ().gameObject.AddComponent<UIDragScrollView> ();
UIEventListener.Get (button.GetComponentInChildren<UILabel> ().gameObject).onClick += textureSelected;
button.GetComponentInChildren<UITexture> ().mainTexture = Resources.Load ("Textures/Buttons/btn_" + availableTextures [i].texture_name) as Texture;
button.GetComponentInChildren<UITexture> ().depth = 5;
}
(this code adds buttons to the scrollview on the right)
when i click on a button on the first scrollview i tween the UIWidget 400 px on the right moving the second scrollview inside the clip area. The problem here is that in some cases not all my buttons are generated as you can see in this image.
Or even worst , with only the texture on the left without label and magnifying glass. Looking around i've found that with UIPanel.SendMessage("OnEnable") i can force redraw of the content ,and in the editor it works but when i deploy the app on a device i get the same problem
Answer by e_tip · Aug 01, 2014 at 10:00 AM
Solved by setting inactive and reactivating the panel in case someone needs
Your answer
![](https://koobas.hobune.stream/wayback/20220613153616im_/https://answers.unity.com/themes/thub/images/avi.jpg)