- Home /
NGUI table does not Reposition() properly
I have a table in a scrollview which I dynamicly fill from code. I iterate through an array of dataobjects, filling the data into a prefab-widget. All works so far. After the elements are all in the table I call the Reposition-method, but it is not properly executed. The paddinge between the elements in the table is much wider than I have set it. The only ways to properly Reposition() the tables elements I have found so far are a) right-clicking the table and chosing "execute" from the context-menu and b) adding Reposition() to the update-function having it execute every frame (sounds like a bad idea considering performance?)
What I tried so far: - putting Reposition() in Update() with a boolean/if-condition that makes it execute only once - trying the same as above with LateUpdate() I have not had any success so far. The Functions themselves seem to work, but they seem to have no effect on the table.
for(int i = 0; i < _items.Length; i++)
{
var itemInstance = NGUITools.AddChild(ItemsPanel, ItemPrefab);
var item = itemInstance.GetComponent<PrefabScript>();
item.Icon.SetTexturePath = _items[i].IconPath;
item.Level.text = _items[i].text;
item.NotPresent.SetActive(_items[i].CurrentWeapon);
}
// make table sort itself
// it doesn't work properly, no clue why
ItemsPanel.GetComponent<UITable>().Reposition();
Answer by SuperbStarling42 · Jan 05, 2018 at 12:18 PM
I now have the same issue. Did you find a solution to this?
Your answer
![](https://koobas.hobune.stream/wayback/20220613190632im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
how will i get every time values in table window? 0 Answers
loading information from a file 0 Answers
NGUI each UI has camera? 1 Answer
NGUI - How to make clickable animated textures/sprites 0 Answers
NGUI Stopped working. why? 1 Answer