Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: TOODX on May 30, 2013, 02:12:01 PM

Title: Adding prefabs causes draggable panel bounds to change
Post by: TOODX on May 30, 2013, 02:12:01 PM
I'm having an issue where I have a prefab with a UIDraggablePanel with preset bounds. On this prefab I have a 3D model which has a number of transforms which I need to dynamically add new prefabs to.

When I add these prefabs, make them children of the transforms and then set their local position to 0,0,0 the bounds for the draggable panel act differently, specifically extending off into the left direction. It is the local position change that does this, as when I remove that line, the bounds do not change. I will get different results based on the number of prefabs I add to the transforms.

 Is there something I'm doing wrong here? How can I ensure the bounds (despite not changing in value) operate the same when I add these child prefabs?
Title: Re: Adding prefabs causes draggable panel bounds to change
Post by: ArenMook on May 30, 2013, 05:40:25 PM
When you use NGUITools.AddChild, it already sets the parent and adjusts the local position. How are you instantiating your stuff?
Title: Re: Adding prefabs causes draggable panel bounds to change
Post by: TOODX on May 30, 2013, 07:42:01 PM
I'm just doing it manually, using Instantiate, casting it as a GameObject, and setting it's transform's parent to the transform within the 3D model. I did try NGUITools.AddChild, but the results were the same. I've also tried using ResetPosition() both before and after parenting the objects, but this also had no effect.