Inserting items in a GridContainer

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By gp1

Having a GridContainer, how to insert an item on the top or in the middle of its existing children?
By default it’s inserting an item on the bottom.

Thank you in advance!

:bust_in_silhouette: Reply From: kidscancode

The grid container is based on child order. When you add a new child, put it where you want it with add_child_below_node() or move_child()

There are many useful methods for managing children in Node: Node — Godot Engine (latest) documentation in English