How to change options of a container spawned through code?

Godot Version

4.2

Question

I can add a container in the script, but don’t know how to access the Container Sizing options. I need to check-off the Expand boxes for both horizontal and vertical too.

If there’s a simple way to copy over the manually placed one’s values into the one spawned in code, that’d be easiest probably. Don’t know how though.
I looked at the documentation but it doesn’t seem to list much of the options that come up in the code editor. Just a single enum with a couple values, none of which are these I mention here.

Found the solution! https://www.reddit.com/r/godot/comments/1akfj3w/how_to_access_container_sizing_flags_via_gdscript/

This would be a great addition to the documentation btw, if anyone’s listening***

What exactly are you missing? If you look up either size_flags_horizontal or size_flags_vertical, it will tell you to “[u]se a combination of the SizeFlags constants to change the flags. See the constants to learn what each does.” Which is exactly what’s explained in that Reddit post you’ve linked?

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