Buttons not clickable on loaded scene

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By alxhoff


I am very new to using Godot and have encountered a problem. My tree structure consists of a level node, background, UI, and an inventory node. My thought process is that the level node works as a state machine that increments the level when it receives a level increment signal. This is working fine, in the signal handler I have the following

func _on_Player_level_completed():
	current_level += 1
	current_level = min(current_level, FINISHED)
	var current_level_node = $CurrentLevel
	if current_level == SEARCHING:
		var next_level_resource = load("res://scenes/level/levels/ExploreLevel.tscn")
		var next_level = next_level_resource.instance()

This loads the level successfully but my problem is that buttons on the scene are not clickable. I have tried menu buttons, buttons and the button I am hoping to use, texture button. The texture button hover does not trigger and the buttons pressed signal cannot be triggered. My levels tree is below.

Another strange behavior I have observed is that sometimes it works when the game runs full screen. Making me think this is more of a project settings problem. I run i3 window manager on arch linux and I make the game’s window float when testing as then it resizes to the screen size i want (480x320), as this game will be running on a specific target screen. When the game starts it starts in a full sized windows (see second image below), with stretch disabled and resizable checked.

I have put the game’s code here. The button in question will appear about 15 seconds into the game.

level tree
non-floating game
floating game

:bust_in_silhouette: Reply From: Eric Ellingson

in World.tscn, can you try moving Level “above” the two CanvasLayers “ItemsUI” and “Inventory”?
Scene tree

Also, for those two CanvasLayer scenes, change the Layer property in the inspector to 0
enter image description here

I made a fork with the change here: GitHub - e-e/bluetooth-beacon-game: Bluetooth beacon game for my colleagues farewell puzzle

I also added a couple of other changes to Level.gd that might be necessary. The most important is setting the new level’s name to "CurrentLevel". This way, next time you change level, the current level will still be referenceable by $CurrentLevel. Also, remove_child() just removes it from the tree. If you want to actually get rid of the node, you should use queue_free()

See https://github.com/alxhoff/bluetooth-beacon-game/pull/1/files#diff-1ca2beac51f2edfbfbbe35b1c19e8d61

Eric Ellingson | 2019-09-23 06:58

:bust_in_silhouette: Reply From: Urok Lobstah

Check the Mouse Filter option under your Control Node. If it is set to “Stop”, it will block all inputs from passing through it. You can set it to “Ignore” if you want it completely allow all inputs to pass through it. The 3rd option “Pass”, I’m still learning about, but the other two I was able to use to get my Pause and Game Over menus clickable again.