Visibility Issues With A CanvasLayer

Godot Version

Godot4

Question

I am having a problem with my inventory system. Hypothetically my code should make it to where details about an item are revealed when the mouse hovers over the item in question but for some reason, my code is not fulfilling that function. Any help is appreciated :slight_smile:

Here is all of my code as it stands:

extends Control

@onready var icon = $InnerBorder/Item_Icon
@onready var quantity_label = $InnerBorder/Item_Quantity
@onready var details_panel = $ItemDetails
@onready var item_name = $ItemDetails/ItemName
@onready var item_type = $ItemDetails/ItemType
@onready var item_worth = $ItemDetails/ItemWorth
@onready var item_effect = $ItemDetails/ItemEffect
@onready var item_blurb = $ItemDetails/ItemBlurb
@onready var item_rarity = $ItemDetails/ItemRarity
@onready var usage_panel = $UsagePanel

var item = null

func _on_ItemButton_pressed():
	if item != null:
		usage_panel.visible = !usage_panel.visible

func _on_ItemButton_mouse_entered():
	if item != null:
		usage_panel.visible = false
		details_panel.visible = true

func _on_ItemButton_mouse_exited():
	details_panel.visible = false

func set_empty():
	icon.texture = null
	quantity_label.text = ""

func set_item(new_item):
	item = new_item
	icon.texture = item["item_texture"]
	quantity_label.text = str(item["quantity"])
	item_name.text = str(item["item_name"])
	item_type.text = str(item["item_type"])
	item_worth.text = str(item["item_worth"])
	item_effect.text = str(item["item_effect"])
	item_blurb.text = str(item["item_blurb"])
	item_rarity.text = str(item["item_rarity"])

func _ready():
	details_panel.visible = false
	usage_panel.visible = false

This is for an Inventory_Slot script but I do have others if you need to see them please let me know.

A further update is that this visibility is only in one of my scenes I found that the item description and usage panels are visible in my shop scene versus my forest scene.


Above is a screenshot of how my Inventory Slots are constructed.

It may have something to do with mouse_filter settings. The node connected to _on_ItemButton_mouse_entered() needs to have mouse_filter set to MOUSE_FILTER_STOP or MOUSE_FILTER_PASS.

Also, if there are other control nodes on top, they should use MOUSE_FILTER_IGNORE so that they don’t block the mouse events.

That was it I realized that there was another control node in my main scene that was in charge of timekeeping UI and it was not set to ignore the mouse. Thank you so much :slight_smile: