Can't change anchor position and TextureRect size

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By rico345100

I’m making UI, and want to set anchor to middle of the image, but changing anchor from Layout → Anchors Only or setting Anchor value directly doesn’t work. The value was updated, but anchor point not moved at all. Is it bug or is there are something that I missed?

Here’s the node tree:

  • CanvasLayer
    • Control
      • TextureRect ← Anchor is not moving at all

Using Godot 3.1.1.

Also I can’t find how to resize texture rect. I can set the min-size, but change size doesn’t work, the value immediately set back to original size. How to change the texture rect size?

Is your TextureRect inside a container node?

kidscancode | 2019-11-09 15:06

No, it’s inside of Control node. Should I change control node type to container? What’s the purpose of using container node?

rico345100 | 2019-11-09 15:51

:bust_in_silhouette: Reply From: LoneDespair

1.Make sure to set your control node to (Full rect) so that it can adjust according to your viewport thus letting its child node → texture rect to keep itself in the middle

2.You could either: -Use scale but it will mess up with your image pivot or Change the resolution of your image

  1. Set control node to full rect doesn’t change anything.
  2. Yep, temporarily I used scale. So, no way to size down?

rico345100 | 2019-11-09 15:50

1.Change the layout of your image to center, then try to expand contract your control node if its child stays in the middle

2.Yup that’s the only way I know of in changing the size of image

LoneDespair | 2019-11-09 17:16