Author Topic: How to create a Box Collider to fit the Widget Size?  (Read 3163 times)

xiaoniaojjj

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 140
    • View Profile
How to create a Box Collider to fit the Widget Size?
« on: September 21, 2012, 05:11:14 AM »
How to create a "Box Collider" easy to fit the size of Widgets. or only by Manual Hand?


dlewis

  • Guest
Re: How to create a Box Collider to fit the Widget Size?
« Reply #1 on: September 21, 2012, 06:04:15 AM »
There is a convenience function will will either create a collider or re-size an existing collider to the size of the widget (including children). The shortcut in the editor is alt + shift + c and I think the code is in NGUITools.cs. I don't have the code open right now so I can't verify the class it's in, just look in the NGUI menu and search the code for the "make a collider" and you'll see where it is.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: How to create a Box Collider to fit the Widget Size?
« Reply #2 on: September 21, 2012, 07:01:19 AM »
NGUITools.AddWidgetCollider(GameObject); //returns the collider