2D Toolkit Forum

2D Toolkit => Support => Topic started by: 1dayitwillmake on May 31, 2014, 07:12:38 pm

Title: Updating collider when re-positioning a button
Post by: 1dayitwillmake 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
Title: Re: Updating collider when re-positioning a button
Post by: unikronsoftware 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.
Title: Re: Updating collider when re-positioning a button
Post by: 1dayitwillmake 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.