我的代码有问题。
所有按钮都可以点击。但是当进入排行榜时。
然后按下退出按钮。
所有按钮都无法使用,并且什么也做不了。 以下是错误信息。
_parse_ext_resource: res://scenes/main_menu.tscn:16 - 解析错误:[ext_resource] 在 res://script/main_menu.gd 引用了不存在的资源
set_path:从路径 'res://scenes/main_menu.tscn' 加载另一个资源(可能包含循环资源)
The problem lies in your leaderboard scene script. You are attempting to load the
main_menu.tscn
scene in the
open_main_menu
function, but you have a typo in the resource path.
Here's the problematic line:
@onready var main_menu = preload("res://scenes/main_menu.tscn")
The issue is that your Main Menu scene is saved as
Main Menu.tscn
(with capital letters), but you are referencing it as
main_menu.tscn
(lowercase).
Godot's file system is case-sensitive, so it treats these as two different files. Since it cannot find a file named
main_menu.tscn
, it throws the "Parse Error: [ext_resource]" you see.
Solution:
Correct the resource path in your leaderboard scene script to match the actual filename:
@onready var main_menu = preload("res://scenes/Main Menu.tscn")
Make sure this path accurately reflects the location of your main menu scene file in your Godot project. Once you've made this change, save your script and try running the game again. The buttons should work correctly after returning from the leaderboard.
标签:godot,godot4 From: 78484727