From 5d02cd16c7105ffebc59a7ae2f2798f9ebfb021f Mon Sep 17 00:00:00 2001 From: kayomn Date: Sat, 21 Jan 2023 15:05:37 +0000 Subject: [PATCH] Reword editor warning for ItemSelection --- user_interface/button_selection.gd | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/user_interface/button_selection.gd b/user_interface/button_selection.gd index 0d9e0f8..f79eb5c 100644 --- a/user_interface/button_selection.gd +++ b/user_interface/button_selection.gd @@ -17,11 +17,15 @@ var item_count: int: func _get_configuration_warnings() -> PackedStringArray: var warnings := PackedStringArray() + var children := get_children() - for child in get_children(): - warnings.append( - "ItemSelection can only have children of type Button, but {0} is of type {1}".format( - [child.name, child.get_class()])) + if not(children.is_empty()): + var self_class_name := get_class() + + for child in get_children(): + warnings.append( + "{0} can only have Button children, but {1} is of type {2}".format( + [self_class_name, child.name, child.get_class()])) return warnings