+1 vote

I have a container within a scroll container which contains speech boxes, much like a messaging app. I use this for a bit of in game dialogue. Whenever the player saves the game I save the contents of the container, as well as the size of the container (as this grows while the scroll container remains fixed). This works great normally. But when I reload the contents and the container size from the save file, the scroll container does not seem to register that the VBox is greater in size and will not scroll, there is also no scroll bar appearing at the side. Does anybody know why this is happening?

in Engine by (295 points)
edited by

1 Answer

0 votes

When you say "VBox" you mean a VBoxContainer right?

How are you saving the speech dialog? If you're saving the dialog as strings then you shouldn't have to save the size of the box container. You could load the strings, construct the labels for them, and insert them into the box container, which should resize itself automatically. This should be reflected by the scroll container assuming the scroll container is of a fixed size.

That said, there are a few bugs with scroll containers not detecting changes in their children correctly (this seems to be an issue with containers in general). You may need to call the scroll container's queue_sort method when its child box container is updated, like in response to the box container's sort_children or resized signals.

by (290 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.