Author Topic: Applying Rigidbody force to NGUI components  (Read 14038 times)

mukulabdagiri

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 11
    • View Profile
Applying Rigidbody force to NGUI components
« on: December 07, 2016, 11:56:50 AM »
Hello,

I have a NGUI sprite, NGUI label and Rigidbody component attached to my gameobject. When I apply force to the rigidbody of my gameobject, only one of the UI components is affected. If I have both the components enabled, then force is applied to the sprite and if I disable the sprite, then force is applied to the label component. I need the force to get applied to all the NGUI components within the gameobject which has a rigidbody. What am i doing wrong or missing?

Thanks

mukulabdagiri

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 11
    • View Profile
Re: Applying Rigidbody force to NGUI components
« Reply #1 on: December 08, 2016, 01:41:19 AM »
Never mind. I put the sprite and label components in separate gameobjects and attached them to another container which has a rigidbody.
This solved the problem.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Applying Rigidbody force to NGUI components
« Reply #2 on: December 08, 2016, 07:10:19 PM »
The rigidbody isn't required, but Unity doesn't like it when there is no rigidbody above a collider that can move around (as is the case with UI). That's the only reason NGUI adds rigidbodies to panels. As long as the root object has a rigidbody, you're fine.