• Godot Help
  • Gridcontainer does not work with my custom scene in it

I want to add my scene into a Gridcontainer but it seems the grid "thinks" the size of the scene is smaller than it is.
As you can see the buttons are ligned up correctly, but the MyControl scene instances overlap:

Here the godot 4 project:

  • JusTiCe8 replied to this.
  • ando Welcome to the containers hell 🙂

    You may have to set "custom minimum size" property in each sub-scenes, you could also add a ColorRect control with alpha set to zero using the size you want (or an invisible TextureRect with a picture of the right size).
    It may not be the best practice at all and I'm still waiting to get some good tutorials & docs about "new", I guess, way to deal with them in Godot 4.

    AFAIU(nderstand), container automatically deal with their content recursively ONLY if at each end, each containing item define its own size, controls into controls into controls does not do that for us and create such overlapping issue.
    It may also be needed to define proper anchors or layouts for each item from bottom to top.

    A good video to watch: from GDQuest with 3.5, still useful. There is also their other video with GridContainer in the same playlist.

    Hope this help.

    ando Welcome to the containers hell 🙂

    You may have to set "custom minimum size" property in each sub-scenes, you could also add a ColorRect control with alpha set to zero using the size you want (or an invisible TextureRect with a picture of the right size).
    It may not be the best practice at all and I'm still waiting to get some good tutorials & docs about "new", I guess, way to deal with them in Godot 4.

    AFAIU(nderstand), container automatically deal with their content recursively ONLY if at each end, each containing item define its own size, controls into controls into controls does not do that for us and create such overlapping issue.
    It may also be needed to define proper anchors or layouts for each item from bottom to top.

    A good video to watch: from GDQuest with 3.5, still useful. There is also their other video with GridContainer in the same playlist.

    Hope this help.

    • ando replied to this.

      JusTiCe8 Thanks alot! Setting the "custom minimum size" worked, the ColorRect and TextureRect did not help.