Hello Guest

Author Topic: Updating collider when re-positioning a button  (Read 5813 times)

1dayitwillmake

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 10
    • View Profile
Updating collider when re-positioning a button
« on: May 31, 2014, 07:12:38 pm »
I'm laying out some objects in code, however when I do that it seems that the colliders maintain their original position.

Previously I was just modifying the transform.localPosition, but I noticed that left the bounds incorrectly displayed in the editor.
So I switched to a simple wrapper that would take a Vec3 position and call SetBounds, but the collider is still in the incorrect spot.

What is the correct way to modify the dimensions / position of a UILayoutItem such that its collider is correctly updated?

Here's an image for reference

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Updating collider when re-positioning a button
« Reply #1 on: May 31, 2014, 07:33:28 pm »
It should move the colliders properly, unless objects are marked as static or something similar? The ui demo 2 moves an entire collection of controls and all their colliders update properly. Take a look and compare, perhaps you may spot something.

1dayitwillmake

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Updating collider when re-positioning a button
« Reply #2 on: May 31, 2014, 07:35:25 pm »
Yeah, I noticed that - very strange because the objects are not marked as static.
I didn't see anything special in the UIDemo from which mine is based, in fact my buttons are just a modified version of the BasicButton (from Layout) prefab.