NazarK0
1 - you have 48 warnings
2 - what does it mean "it crash"? you have to be more specific. what level of crash are we talking about? does it return to the editor with an error (and if so what error)? does it core dump? does it stop working forcing you to ctrl+alt+del?
3 - please show a screenshot of the editor after running the game so we can see the hardware description in godot, or tell us what hardware you are running it on. you are on forward+ and that requires a modern computer with support for vulkan 1.1/1.3.
4 - it could also be the code.
you are connecting the signal in editor to a script in new game
.
try putting the script in Control
instead and connecting from there, and then doing queue_free()
instead of %Control.queue_free()
doing %
is equivalent to get_node()
.
the FileSystem is also missing level_1
somehow.
also, instantiate the level when the button is pressed, otherwise the level is kept in the background.
main_menu.gd
@export var level1 : PackedScene #set your level1 in inspector, the path will update if you move the file
func _on_pressed() -> void:
var new_game = level1.instantiate() #load the level
add_sibling(new_game) #add the new node parallel instead of as child
queue_free() #delete self, IE Control, containing the entire menu