Hi,
I am having some strange issues with UIDragPanels. This is what I am doing:
- I have a horizontal grid of buttons that go across the screen.
- The buttons are added to the grid at runtime.
- The buttons are prefabs, that are setup using textures pulled form asset bundles like so:
btnTex = NGUITools.AddWidget<UITexture>(transform.gameObject);
btnTex.material = new Material(Shader.Find("Unlit/Transparent Colored"));
btnTex.material.mainTexture = texOff;
btnTex.MakePixelPerfect();
GetComponentInChildren<UILabel>().text = name;- I have a temp loading button which is also a prefab but uses sprites from an atlas.
- Once the buttons are loaded the temp button is removed
- The buttons all get added to the grid ok, and I can scroll them.
Things get weird when I try and interact with them. I can only ever click on the buttons that are visible in the left hand part of the list.
For example, the following buttons are shown:
ABCD
I can only click on A and B.
If I scroll the list so
CDEF are showing, then I can only click on C and D.
While in play mode if I drop my load button onto the list, suddenly I can click on any of the buttons, but I can't see what is being done differently between this and what I am doing programatically.
Any suggestions?
I have tried calling the following, before and after adding and removing the buttons.
menuGrid.Reposition();
dragPanel.ResetPosition();
dragPanel.repositionClipping = true;Finally, this was working on an older version of NGUI, before the new UIDragpanel was added (pre scroll bars).
Cheers.