Author Topic: 3.0.3 Instantiating prefabs reset box colliders dimensions  (Read 3031 times)

rblanchet

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
3.0.3 Instantiating prefabs reset box colliders dimensions
« on: October 28, 2013, 01:53:32 PM »
Hello,
Since 3.0.3, instantiating prefabs that contain box colliders have their size reset to 0, 0, 0.
I'm not talking about top level game object here. These box colliders are several levels deep.

See attachments.

rblanchet

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: 3.0.3 Instantiating prefabs reset box colliders dimensions
« Reply #1 on: October 28, 2013, 04:37:42 PM »
I seem to have tracked it down a bit.

If I have auto-adjust to match checked and save the prefab and then instantiate it. The box collider gets reset. What is interesting is the prefab yaml doesn't appear to match what the editor shows. The yaml output shows that the box collider has been edited to 0,0,0 - but when I see it in the editor its got the correct dimensions until I actually instantiate it.

If I turn off auto-adjust to match, and then manually change the dimensions and save - it appears to work fine.

As soon as I re-enable auto-adjust, and save it - even though the box collider dimensions don't appear to change in the editor, as soon as I instantiate the prefab its dimensions are 0,0,0 and looking at the yaml file it says they have been changed to 0,0,0.

« Last Edit: October 28, 2013, 04:43:02 PM by rblanchet »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 3.0.3 Instantiating prefabs reset box colliders dimensions
« Reply #2 on: October 29, 2013, 12:42:16 AM »
Try changing UIWidget.ResizeCollider to:
  1.         void ResizeCollider ()
  2.         {
  3.                 if (NGUITools.IsActive(this))
  4.                 {
  5.                         BoxCollider box = collider as BoxCollider;
  6.                         if (box != null) NGUITools.UpdateWidgetCollider(box, true);
  7.                 }
  8.         }

rblanchet

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: 3.0.3 Instantiating prefabs reset box colliders dimensions
« Reply #3 on: October 29, 2013, 11:53:34 AM »
Thanks for the quick fix.