Panel nodes and similar nodes like TextureRects are forced to a size.x of zero and I have no concept of why?!

Godot Version

Godot 4.5

Question

I have zero concept as to why this is happening, I am trying this carousel thing and all the child nodes just get their size.x set to 0.0 for no reason and I cannot fathom as to why! it also happens for anything under a HBox container or anything similar, any help would be much appreciated

Okay, it’s clear now that it is because it is the child of a Node 2D, how on earth do I stop this being the case?

I’ve found a temporary fix and that is by changing the anchors preset of the control node, it can break again but that is a temp fix for anyone looking, I won’t close it just yet in case anyone has a permanent one, but if not I will close it then

Child node transforms of a Node2D are not affected by the parent.
In your case the parent is a Node2D, however it is a tool (@tool) and the code therein is likely what is causing your issues.
Can’t say why without looking at that code.

Child control nodes of a container will get their size and position from the parent.
For ordinary containers you set the custom minimum size properties of the child controls to force the container to keep the node at that size.

1 Like

Thank you for the reply! Nothing in my code sets size or anything like that, it’s super weird but I am gonna assume it’s because it’s a tool, also minimum size properties just don’t work for me for whatever reason, they also don’t work on HBox’s for me either.

I just think I suck at UI hahahaha

Well for sure custom minimums work with HBox and VBox but remember, they only work with child nodes that are or inherit from Control.

I must have been doing something dumb, it’s fine though, it’s working now!

It definitely was because it’s a tool and messing with the exports breaks it

1 Like