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?


The layout options will change the anchor points of a Control, and you can resize a TextureRect by setting expand to true. You can demonstrate this to yourself:

  1. Start a new project
  2. Create a Control
  3. Add a TextureRect as the child
  4. Set the included "icon.png" as the texture
  5. Set expand=true
  6. Click Layout > Full Rect

Note that the Anchors are now set to (0, 0, 1, 1) and the rect size is 1024x600.

want to set anchor to middle of the image

The way you descibe this suggests that maybe you mean the "pivot point" and not the "anchors". The pivot point is the little red cross in the UI, and is set under the Rect category of Control.

Here's screenshots of the pivot at 0x0 and 32x32:



| improve this answer | |

Your Answer

