Center container issue

I have nested container, the logic is to have a center container that centers everything in the screen.
Easy done by setting the center container to size of the screen.

The problems with this are few things:

  • center container center everything but it dos not allow positioning relative to it(i didn’t find if there is a way to this)
  • the other problem is that the container inside of it for example should have its position some where, so it can be draw correctly on the screen. That holds true when you look to the settings of this container and see that the position is changed by the center container. That is great and all but when the game runs those parameter for position is set to 0, also true for global position, everything is zeroed. WTF, I need those information, why center container has to be an ass?
    Center container should always be a relative relation, as all the control nodes should be.

This thing that controls just take over the parameter of their children and no way for you to change their position relatively with the container is garbage! If there is a way please tell, the settings for the nodes are no that intuitive or hidden.

Not really good explanation and description or any information on the documentation.

So here is my only way to appeal.
If anybody knows what I am talking about and how to go about please share.

Most of the time you don’t actually need a CenterContainer, you can just anchor your Control nodes in the middle. That way it’ll stay centered relative to its parent.

1 Like

not sure what do you have in mind.
anchor just use the positioning at the specific location in the object isn’t it? it has nothing to do with the parent.
Every thing by default is anchor to the top left corner, changing anchor will just make it so in another location in the object in question.

Now the problem is that the container take over the objects and the number are not relative at all, as far as I could see it.

But what you say basically is that center container is useless.

Just during the first frame. Then the values are correct and can be changed:

extends CenterContainer

func _ready() -> void:
    print(get_child(0).position)     # returns (0, 0)
    get_child(0).position.x += 500   # won't work

    await get_tree().process_frame   # wait one frame

    print(get_child(0).position)     # returns correct position
    get_child(0).position.x += 500   # works!

Keep in mind, though, that the container might override those values on certain events!