Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Quarkism on March 24, 2014, 05:47:36 PM

Title: ScrollView-->Grid-->Widget-->Sprite Positioning error
Post by: Quarkism on March 24, 2014, 05:47:36 PM
Gif of the error
http://i.imgur.com/sH4S4Bh.gif

So I have a multiplayer game lobby. When a player joins the game a new item (A widget placed inside grid inside a scroll view) is added to the listing. When this happens the portrait, rank, and lag sprites for the item are positioned incorrectly (offset to the left) on the host. It works fine for the client instance (oddly). When I tab to scene view the sprites are magically aligned correctly. When I tab back to game view the issue is gone.

I'm not sure what to do to fix this. Is there a message I can push to my child objects or the scroll view to make them snap into place (for the time being)?
Title: Re: ScrollView-->Grid-->Widget-->Sprite Positioning error
Post by: ArenMook on March 24, 2014, 06:31:13 PM
What version of NGUI are you using here, and is the UIGrid the only method of positioning you're using or do you have something anchored? UIGrid's Reposition() function should do the job if it's the only thing you have.
Title: Re: ScrollView-->Grid-->Widget-->Sprite Positioning error
Post by: Quarkism on March 24, 2014, 07:38:48 PM
What version of NGUI are you using here, and is the UIGrid the only method of positioning you're using or do you have something anchored? UIGrid's Reposition() function should do the job if it's the only thing you have.

3.5.5

The scroll is anchored
The grid inside the scroll is not anchored
The item (sprite) is anchored to the scroll (Advanced left/right binding only)
The pictures inside the item (this is where the problem is) are anchored to the item

I am calling UIGrid.Reposition() after I add the items to the grid.

I am calling it 1 frame after the items have been added.

This is a strange bug... being that it fixes itself If I change to the scene tab or activate/deactivate the object.
Title: Re: ScrollView-->Grid-->Widget-->Sprite Positioning error
Post by: ArenMook on March 26, 2014, 03:10:53 AM
Don't hide your game view behind your scene view. When the game view is hidden, there is no way to determine its size. It's an issue in Unity.