How can i stick these flags to the map?

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

They follow the Control, but i need them to follow the actual texture. How can i do that?
I need these flags as separate nodes.

Tree structure:
Map - TextureRect
----Flag - TextureRect
----Flag2 - TextureRect

enter image description here

:bust_in_silhouette: Reply From: Sween123

Change the stretch mode to “scale on expand(compat)”

This does not answer the question: while it will scale the maps texture to the size of the bounding box, it won’t move the flags. Plus it’s the default value anyways. In order for it to take effect however, you’d need to check the expand-property in the editor.

njamster | 2020-02-08 14:56

The map texture’s size won’t change unless you turn on the property “expand”.
Definitely if you are just resizing the Map Control size you won’t move the flags since that’s focus on the designing of Map itself, once your map is done, to keep the flags with the Map as a whole, you simply change the position or the scale of the Map.

Sween123 | 2020-02-08 23:23

:bust_in_silhouette: Reply From: njamster

Select your flag, then click the “Layout”-Button in the 2D view (it’s visible in your screenshot, second button to the right) and select “Center”. This will center the flag relative to the boundary region of its parent: the map. To offset the flag from the center, simply change the anchor-values in the inspector. They are fractions of the width / height, i.e. a left-value of 0.7 means “position this control node at 70% of it’s parents bounding box width”.