Author Topic: Bug when moving items from one UIGrid to a second UIGrid  (Read 3603 times)

soofaloofa

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 27
    • View Profile
Bug when moving items from one UIGrid to a second UIGrid
« on: April 19, 2012, 09:54:48 AM »
Hi,

Version: NGUI 2.0.3 b

I am moving an existing item from one UIGrid to another at runtime. The problem is that the Widgets do not seem to be updating correctly when I do the move. You can test this by creating two UIGrids and then dragging an item from one to another using the Hierarchy view. Press Reposition Now on both grids and the updated grids do not update (items are missing).

I have the same problem when moving an item to a grid programmatically with the following code:

  1.         private void MoveObjectToThisUIGrid(GameObject go)
  2.         {
  3.                 Transform t = go.transform;
  4.                 t.parent = transform;
  5.                 t.localPosition = Vector3.zero;
  6.                 t.localRotation = Quaternion.identity;
  7.                 t.localScale = Vector3.one;
  8.                 go.layer = gameObject.layer;
  9.  
  10.                 mGrid.Reposition(); // mGrid is a reference to the attached UIGrid Component
  11.                
  12.         }
  13.  




soofaloofa

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 27
    • View Profile
Re: Bug when moving items from one UIGrid to a second UIGrid
« Reply #1 on: April 19, 2012, 10:51:31 AM »
Looking at this some more I've found that my object is still being clipped by the old UIPanels clipping area. Is there a way to force the clipping panel to be updated?

Thank you!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Bug when moving items from one UIGrid to a second UIGrid
« Reply #2 on: April 19, 2012, 11:49:11 AM »
Have you tried setting 'repositionNow = true' instead of calling Reposition? Parenting may not update right away, I vaguely remember running into this long before NGUI.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Bug when moving items from one UIGrid to a second UIGrid
« Reply #3 on: April 19, 2012, 11:50:42 AM »
As for clipping still affecting the widget? I'm not getting this. The drag & drop example does the same thing: it moves an item out of a clipped panel, and it doesn't get clipped.

soofaloofa

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 27
    • View Profile
Re: Bug when moving items from one UIGrid to a second UIGrid
« Reply #4 on: April 19, 2012, 12:15:23 PM »
I've sent you an e-mail with a scene that reproduces the problem.