Author Topic: Box Collider not correctly positions when using anchor and pivot on a UIButton  (Read 3930 times)

aer0ace

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
I'm having an issue with a Box Collider on a UIButton.

I programmatically assign a pivot to the UISprite (say, lower left corner) and assign a UIAnchor component (say also lower left).

This correctly positions the geometry against the lower left corner, but the box collider seems to only detect collisions when the mouse is on the left half of the button, when I would want it to be over the entire button.

Anything I'm doing wrong here?

aer0ace

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Actually, figured it out.

After setting the pivot on the UISprite, call ResizeCollider(), even though it's set to auto resize in the script properties.