![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | chanon |
Suppose I have a ColorRect inside a Control.
I set the ColorRect’s anchors to
left 0.5, right 0.5, top 0, bottom 0
I adjust it in the editor view so the ColorRect is nicely centered in the Control.
Then suppose at run-time I want to resize the ColorRect’s width to be wider. How can I easily do this while keeping the ColorRect centered?
What I tried was to change the rect_size.x in code, but this just resulted in the ColorRect getting longer to the right but not centered.
I thought having anchors would mean resizing it would keep it centered?