Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: wallabie on March 30, 2014, 02:39:35 AM
-
Hi,
I'm trying to add items to a scrollview that has a Grid. The new items are being added by instantiating a prefab and then parenting to the Grid. The problem is that the scrollList does not update to show the new added item. I have a feeling that this is not the correct way to add items dynamically to the scrollview. What is the recommended way to do this.
This is another use case of trying to make an NGUI component data aware to dynamically changing data.
-
UIGrid.Reposition() must be called after adding any new children to the grid.
UIWidget.MarkParentAsChanged() must be called if you moved the widget from A to B.
-
"UIWidget.MarkParentAsChanged() must be called if you moved the widget from A to B."
You mean when one of the items of ScrollList A is moved to ScrollList B?
-
That's one example, yup. If you change a transform.parent, you must notify that transform that its parent has changed -- you can use the NGUITools.MarkParentAsChanged helper function and it will do the recursive updates for you.