Skip to content

Instantly share code, notes, and snippets.

@TheOrioli
Last active October 17, 2024 22:04
Show Gist options
  • Save TheOrioli/841c85fc6d0c7172593218b14ddce6c5 to your computer and use it in GitHub Desktop.
Save TheOrioli/841c85fc6d0c7172593218b14ddce6c5 to your computer and use it in GitHub Desktop.
GDScript that offsets children of a VBoxContainer
@tool
extends VBoxContainer
@export var offset: Vector2 = Vector2.ZERO
func _notification(what: int) -> void:
match what:
NOTIFICATION_SORT_CHILDREN:
for i in get_child_count():
var c := get_child(i)
if c is Control:
c.position += offset * i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment