Probelm with PanelContainer

Godot Version

4.2.1 stable


I have a panel to show some information about items, its structure is shown below:

you can see the original size of the PanelContainer Node is 85 x 143

sometimes an item’s information can be very long, which can expand the panel like this:

and you can see the size of the PanelContainer Node is now 191 x 143

The problem is that, when I run the code and try to print the size of the PanelContainer Node, the results are always 85 x 143

It seems that the part expanded due to content does not really change the size of the PanelContainer node?

What should I do if I want to get the extended size of the PanelContainer Node??

The size does not get updated until the PanelContainer has sorted its children which happens at the end of the frame. You’ll need to wait a frame between changing the content and the size gets updated. You can listen to the signal Control.resized to know when the PanelContainer has been resized.

1 Like

Thanks, it really helps :100:, I tried what you suggested, and it works just fine~~ :heart_eyes: :heart_eyes:. Hope you have a nice day!~

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.