Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: AndreasRk on May 21, 2014, 06:53:43 PM
-
Hi,
I have a problem with a UIGrid.
What happens is, that I instantiate a prefab (just a gameObject, with transform, UISprite, a simple script of mine and a box collider).
The UISprite is in the dimension of 100x100. Native proportions of the file are 170x170. The Box Collider is on 90x100.
After I added the prefab (transform.parent = grid.transform ) and executed the reposition (per hand or per code) the dimension of the UISprite jumps to 640x640 and the box collider is set to 640x640 as well.
This only applies to "new" objects. If I do not remove the objects and readjust the sizes, they are not touched, but new ones are still altered.
I tried to search the UIGrid code, but was unable to find anything that seemed to be the issue.
I hope that my humble try to explain the problem is sufficiant thank you for your help.
-
You need to use NGUITools.AddChild, not Instantiate.
-
Thx mate