Open nvanfleet opened 6 months ago
What version of Godot are you using? I can't reproduce this issue on 4.2.1 release. Godot does not let me open a scene with missing dependencies and provides a proper dialog window for fixing them.
What version of Godot are you using? I can't reproduce this issue on 4.2.1 release. Godot does not let me open a scene with missing dependencies and provides a proper dialog window for fixing them.
I am using 4.2.1 but I think you missed my description. The PackedScene is set onto an @Export of my custom SwiftGodot class. It's not in the node tree of the scene.
I think that's what I was trying to do. I have a trivial SwiftGodot class with PackedScene export:
@Godot
final class SomeScene: Node {
@Export
var otherScene: PackedScene?
}
and its scene file Scene.tscn
:
[gd_scene load_steps=2 format=3 uid="uid://hmmqvij3if3d"]
[ext_resource type="PackedScene" uid="uid://cvyspe7pi4ooy" path="res://OtherScene.tscn" id="1_kkivn"]
[node name="Node2D" type="SomeScene"]
otherScene = ExtResource("1_kkivn")
If I delete OtherScene.tscn
and restart Godot, it will throw some errors in the console:
scene/resources/resource_format_text.cpp:448 - res://Scene.tscn:3 - ext_resource, invalid UID: uid://cvyspe7pi4ooy - using text path instead: res://OtherScene.tscn
Cannot open file 'res://OtherScene.tscn'.
Failed loading resource: res://OtherScene.tscn. Make sure resources have been imported by opening the project in the editor at least once.
scene/resources/resource_format_text.cpp:284 - res://Scene.tscn:6 - Parse Error:
Failed loading resource: res://Scene.tscn. Make sure resources have been imported by opening the project in the editor at least once.
editor/editor_data.cpp:626 - Index p_idx = 1 is out of bounds (edited_scene.size() = 1).
and present a dialog allowing to fix missing dependencies.
What if you load your game with that scene in the main file
On Feb 19, 2024, at 12:42 PM, Mikhail Tishin @.***> wrote:
I think that's what I was trying to do. I have a trivial SwiftGodot class with PackedScene export:
@Godot final class SomeScene: Node {
@Export var otherScene: PackedScene?
} and its scene file Scene.tscn:[gd_scene load_steps=2 format=3 uid="uid://hmmqvij3if3d"]
[ext_resource type="PackedScene" uid="uid://cvyspe7pi4ooy" path="res://OtherScene.tscn" id="1_kkivn"]
[node name="Node2D" type="SomeScene"] otherScene = ExtResource("1_kkivn") If I delete OtherScene.tscn and restart Godot, it will throw some errors in the console:
scene/resources/resource_format_text.cpp:448 - res://Scene.tscn:3 - ext_resource, invalid UID: uid://cvyspe7pi4ooy - using text path instead: res://OtherScene.tscn Cannot open file 'res://OtherScene.tscn'. Failed loading resource: res://OtherScene.tscn. Make sure resources have been imported by opening the project in the editor at least once. scene/resources/resource_format_text.cpp:284 - res://Scene.tscn:6 - Parse Error: Failed loading resource: res://Scene.tscn. Make sure resources have been imported by opening the project in the editor at least once. editor/editor_data.cpp:626 - Index p_idx = 1 is out of bounds (edited_scene.size() = 1). and present a dialog allowing to fix missing dependencies.
— Reply to this email directly, view it on GitHub https://github.com/migueldeicaza/SwiftGodot/issues/398#issuecomment-1953135548, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALK4P2BKHHBS53H3MN6G3DYUO2K3AVCNFSM6AAAAABDLEKKNCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJTGEZTKNJUHA. You are receiving this because you authored the thread.
Same errors, no crash:
W 0:00:00:0412 load: res://Scene.tscn:3 - ext_resource, invalid UID: uid://cvyspe7pi4ooy - using text path instead: res://OtherScene.tscn
<C++ Source> scene/resources/resource_format_text.cpp:448 @ load()
E 0:00:00:0412 load: Cannot open file 'res://OtherScene.tscn'.
<C++ Error> Condition "err != OK" is true. Returning: Ref<Resource>()
<C++ Source> scene/resources/resource_format_text.cpp:1643 @ load()
E 0:00:00:0412 _load: Failed loading resource: res://OtherScene.tscn. Make sure resources have been imported by opening the project in the editor at least once.
<C++ Error> Condition "found" is true. Returning: Ref<Resource>()
<C++ Source> core/io/resource_loader.cpp:275 @ _load()
E 0:00:00:0412 _parse_ext_resource: res://Scene.tscn:6 - Parse Error: [ext_resource] referenced non-existent resource at: res://OtherScene.tscn
<C++ Source> scene/resources/resource_format_text.cpp:163 @ _parse_ext_resource()
@Export var packedScene: PackedScene?
What happens: Godot crashes with the information at the bottom of this
Expected to happen: I would expect an PackedScene that has been initialized with a invalid path to ultimately end up returning nil or otherwise being initialized but broken.