From 3bdb5d3a2a87cb0db9d5462cdf75770bb0980502 Mon Sep 17 00:00:00 2001 From: Damien Ostler Date: Mon, 8 Jan 2024 00:11:47 -0500 Subject: [PATCH] fix bug where the context menu does not go away when you click off --- grid_inventory_system/scripts/InventoryController.gd | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/grid_inventory_system/scripts/InventoryController.gd b/grid_inventory_system/scripts/InventoryController.gd index 91704dd..d874dc9 100644 --- a/grid_inventory_system/scripts/InventoryController.gd +++ b/grid_inventory_system/scripts/InventoryController.gd @@ -75,6 +75,8 @@ func try_to_open_context_menu(): if(inventory_context_menu!=null): inventory_context_menu.queue_free() show_context_menu(mouse_position,item.item_config) + else: + hide_context_menu() # Function to show the context menu at a specific position @@ -89,7 +91,8 @@ func show_context_menu(mouse_pos: Vector2, item: ItemConfiguration): # Function to hide the context menu func hide_context_menu(): - inventory_context_menu.queue_free() + if(inventory_context_menu!=null): + inventory_context_menu.queue_free() func context_menu_open(): print("OPEN!")