Max Size Container

An asset by MattUV
The page banner background of a mountain and forest
Max Size Container thumbnail image
Max Size Container thumbnail image
Max Size Container thumbnail image
Max Size Container hero image

Quick Information

0 ratings
Max Size Container icon image
MattUV
Max Size Container

A custom Container node for Godot Egine 3.x, to limit the size of children nodes.All Control nodes have a rect_min_size property, but they lack the rect_max_size. The MaxSizeContainer aims at solving this issue.To be limited in size, a Control node must be child of a MaxSizeContainer.INSTRUCTIONS: - From the editor, press Add a new node, and select MaxSizeContainer.Note: to add the Container from script, you must use this code: var MaxSizeContainer = preload("res://addons/MaxSizeContainer/max_size_container.gd") add_child(MaxSizeContainer.new()) - Add any Control node as a child of MaxSizeContainer. Note: only one (1) child is supported - Select the maximum size, and how you want the child node aligned when it reaches the maximum size. (-1 means no limit)

Supported Engine Version
3.4
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
2 years ago
Git URL
Issue URL

MaxSizeContainer for Godot 3.x

A custom Container node for Godot Egine 3.x, to limit the size of children nodes.
All Control nodes have a rect_min_size property, but they lack the rect_max_size. The MaxSizeContainer aims at solving this issue.

README DemoGif

Installation

  • Copy addons/MaxSizeContainer into your project (final path should be res://addons/MaxSizeContainer).

README FileSystem

  • In the Godot Editor, go to Project Settings > Plugins and enable the MaxSizeContainer plugin.

README PluginMenu

Usage

To be limited in size, a Control node must be child of a MaxSizeContainer.

  • From the editor, press Add a new node, and select MaxSizeContainer

README AddNewNodeMenu
Note: to add the Container from script, you must use this code:

var MaxSizeContainer = preload("res://addons/MaxSizeContainer/max_size_container.gd")

add_child(MaxSizeContainer.new())
  • Add any Control node as a child of MaxSizeContainer.
    Note: only one (1) child is supported

  • Select the maximum size, and how you want the child node aligned when it reaches the maximum size.
    README Properties
    (-1 means no limit)

Examples

  • Let's start from this scene.
README SceneTree README SmallWindow README LargeWindow
Scene tree Small window Large window

When the window is enlarged, the main scene takes all the available space, as it is set as Expand.

  • To prevent that and make the text more readable, let's add a MaxSizeContainer, child of MainScreen (ScrollContainer) and parent of VBoxContainer:
README SceneTree README Parameters README LargeWindow
Scene tree Parameters Large window
  • You can also nest different MaxSizeContainers together, and have fun:
README SceneTreeAndParameters README LargeWindow
Scene tree and parameters Large window

Troubleshooting

If the container doesn't work, try these solutions:

  • Make sure there is only one child node, and it inherits from Control
  • Make sure the child node's size flag are set to Fill vertically and horizontally.
  • Make sure max_size is bigger than the minimum possible size of the child.

License

See License file
This README page was greatly inspired by jmb462.

A custom Container node for Godot Egine 3.x, to limit the size of children nodes.
All Control nodes have a rect_min_size property, but they lack the rect_max_size. The MaxSizeContainer aims at solving this issue.

To be limited in size, a Control node must be child of a MaxSizeContainer.

INSTRUCTIONS:
- From the editor, press Add a new node, and select MaxSizeContainer.
Note: to add the Container from script, you must use this code:
var MaxSizeContainer = preload("res://addons/MaxSizeContainer/max_size_container.gd")
add_child(MaxSizeContainer.new())

- Add any Control node as a child of MaxSizeContainer.
Note: only one (1) child is supported

- Select the maximum size, and how you want the child node aligned when it reaches the maximum size. (-1 means no limit)


Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Max Size Container icon image
MattUV
Max Size Container

A custom Container node for Godot Egine 3.x, to limit the size of children nodes.All Control nodes have a rect_min_size property, but they lack the rect_max_size. The MaxSizeContainer aims at solving this issue.To be limited in size, a Control node must be child of a MaxSizeContainer.INSTRUCTIONS: - From the editor, press Add a new node, and select MaxSizeContainer.Note: to add the Container from script, you must use this code: var MaxSizeContainer = preload("res://addons/MaxSizeContainer/max_size_container.gd") add_child(MaxSizeContainer.new()) - Add any Control node as a child of MaxSizeContainer. Note: only one (1) child is supported - Select the maximum size, and how you want the child node aligned when it reaches the maximum size. (-1 means no limit)

Supported Engine Version
3.4
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
2 years ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers