Last active
October 17, 2024 22:04
-
-
Save TheOrioli/841c85fc6d0c7172593218b14ddce6c5 to your computer and use it in GitHub Desktop.
GDScript that offsets children of a VBoxContainer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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