Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Sahkan on May 11, 2014, 11:20:09 AM
-
If i try to move the sprite the script on it it works .
but if i try to instantiate sprites in certain order and then access them it wont move them .
The funny thing is : I can rename them, i can print their position ( Which prints the right position but in the viewport it is not moving at all )
And more : all these was in edit mode ( [ExecuteInEditMode] ) .
If i do the same in runtime it works, but i cant save it, if i try to copy the sprites when it runs, stop the game, past the sprites, their position return to 0.0.0 again... How can i fix that ?
-
That's the way Unity works. Changes done in playmode are never* saved. Question is, how are you instantiating them and how are you trying to rename them? Post some code, and we can see where it goes bad.
*Certain exceptions exist, since changing the raw assets will persist.
-
I guess if the object with the "UIScroll view" on it and the "UIPanel" on it is marked on static could make this happen ? i got away with an other solution but i guess this would of fix it, am i right ?
-
Possibly. If it's marked Static, it means just that - it will not update the positon, rotation or scale. Removing static should fix that.
-
Just rechecked it, it wont matter if the sprite is even in the root ( UIRoot ) . the moment you check ( Turn it on ) the " UILabel " component or the " UISprite " component it snaps to 0,0,0 .
-
NGUITools.AddChild instantiates everything at (0, 0, 0) relative to the parent. I don't know what you're using there. If simply turning on a sprite makes it snap, then I'd wonder what else you have there. Nothing on the sprite would change its position. Unless you have anchors enabled, perhaps.