Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: arkon3 on August 27, 2015, 08:22:16 PM

Title: Sprites disappear when moving them via code
Post by: arkon3 on August 27, 2015, 08:22:16 PM
I have a UIPanel set to soft clip with a scroll view attached. I then have 20 game objects as children of this, basically sprites with a label attached, like a list view. the clipped panel is big enough to show 20 of them and the user then scrolls the view up an I in code just move the 1st child (Sprite and Label) to the bottom of the children.

This works about 70% of the time but a few of the moved children have the sprite not visible even though it's all moved to its new location ok. if in the editor I click the enable box on the sprite twice it now magically reappears.

I move the sprite just by changing it's .localposition
Title: Re: Sprites disappear when moving them via code
Post by: ArenMook on August 30, 2015, 12:11:09 PM
Have you seen the UIWrapContent script shown in the last example that comes with NGUI? It does what you're trying to do already -- reuses a certain number of items to create a much longer scroll view. As for your issue, make sure your panel's "Is Static" flag is not checked.
Title: Re: Sprites disappear when moving them via code
Post by: arkon3 on September 08, 2015, 09:00:09 AM
Cool, static ticked was the cause. I'll try the wrap thing and see how I get on.