Author Topic: Adding prefabs causes draggable panel bounds to change  (Read 3878 times)

TOODX

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Adding prefabs causes draggable panel bounds to change
« 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?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Adding prefabs causes draggable panel bounds to change
« Reply #1 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?

TOODX

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Adding prefabs causes draggable panel bounds to change
« Reply #2 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.