Author Topic: "Attach a collider" - which function is called?  (Read 3546 times)

lime-green.at

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 60
    • View Profile
"Attach a collider" - which function is called?
« on: November 04, 2012, 02:08:27 PM »
Hey,

i need to attach a collider at runtime, but when i use the BoxCollider Component provided by Unity3d itself, the bounds aren't right.
If i attach a collider from the NGUI Menu, it fits. So i need to know how to attach a ngui collider from script.

Regards

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Re: "Attach a collider" - which function is called?
« Reply #1 on: November 04, 2012, 02:58:15 PM »
Hey,

Just a small research in the code told me :

  1. NGUITools.AddWidgetCollider(YOUR_GAME_OBJECT);

lime-green.at

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 60
    • View Profile
Re: "Attach a collider" - which function is called?
« Reply #2 on: November 05, 2012, 02:22:12 AM »
Thanks for that information, i was searching for the keywords "collider", "box", ... etc., couldnt find anything.

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Re: "Attach a collider" - which function is called?
« Reply #3 on: November 05, 2012, 04:46:52 AM »
No problem!

As the text in the menu is "Attach a collider", I searched "Attach" ;)
Also, all of these utils methods are usually in the NGUITools script!