#False positive missing dependencies error Godot 4.2

39 messages · Page 1 of 1 (latest)

plain lichen
#

So I am working on a room scene that can create inherited scenes to represent each of the rooms in my game. A player can exit off the screen in one of the four directions and the GameManager scene will be signaled to run a method that frees the room the player is currently in while instantiating and adding the new room scene into the scenetree, then it will set the players position to the correct entrance spawn position. On the player side it should look like they change rooms, IE they walk off the right side of the screen, they enter the next room and begin on the left side of the screen.

In my Room scene I exported 4 variables of type PackedScene to represent the 4 available exit scenes. The idea being that you could select the appropriate rooms to link up for each individual room inherited scene.

The problems began when I ran a test where you would walk from one room to the other and back. The system worked fine going from the starting room the second room but when trying to return back, it threw an error. I cannot replicate this now so I cannot recall the exact error. It essentially stated that the left exit packed scene variable was null. I confirmed this was true at runtime in the remote tree, but in the local tree in-editor, it was set to the starting room scene as intended. I went to forums to try to find the solution there and they mostly just said "godot sucks, this has been a bug for years. sometimes it fixes itself if you reload the project." so I reloaded my project and thats when things got even worse. It is now giving me "dependency error" popups for almost every scene in my filesystem but when I go to fix them, they are all assigned to the correct file paths. Godot doesn't even recognize any issues in its dependency reassignment popup window but it will fail to load any of my scenes.

What do I do here? Any advice on next steps?

keen copper
#

Can try exiting Godot
Opening project folder
deleting the.godot folder inside
Restarting Godot

#

I believe a lot of causes of this issue are fixed in 4.3

#

A frustrating one for sure though

plain lichen
#

@keen copper do you recommend if I can get it working, going onto the LTS build for 4.3?

#

just tried those tips and also tried downloading 4.3 snapshot 5 and reimporting to that version of godot

#

nothing helped

#

:/

viral fractal
#

I had a similar issue this week and the fix was to open the glitched .tscn files and manually update or remove the referenced resources.
From your screenshot the error is in line 7 of starting_room.tscn

#

What I ran into was definitely glitchy behavior that is now top of my red flag list for Godot.

plain lichen
#

@viral fractal I'm scared i'll get months into a project only to have it all break

#

Thank you though, I will try that

viral fractal
#

I started using Git to ensure I have recoverable states (as we all should on any kind of code project), which will avoid that problem. But it was a scary moment to have my project not load..

plain lichen
#

Got it, thanks man

#

I do have a git repo in this directory but I was on initial commit still, thankfully this project is so small it isnt the end of the world either way but yeah shit is so frustrating

plain lichen
#

@viral fractal Could you walk me through this?

#

If you have a moment I would be willing to hop on a brief call and screenshare

#

Basically I am looking into the .tscn files in VS Code and the dependencies/references look right to me but also if I edit them in anyway godot just reads the file as "corrupt scene" and it becomes unusable

viral fractal
#

What is on line 7? That’s the error line in your screenshot

plain lichen
#

Well it is throwing different errors each time

#

As I mess with things

#

But they are all very similar to "E 0:00:00:0585 _parse_ext_resource: res://scenes/rooms/room_2.tscn:10 - Parse Error: [ext_resource] referenced non-existent resource at: res://scenes/rooms/room_1.tscn
<C++ Source> scene/resources/resource_format_text.cpp:163 @ _parse_ext_resource()
"

#

It seems like the core issues it has are with the room_1, room_2, and main .tscn's

#

@viral fractal

viral fractal
#

It’s not possible to suggest any fixes without seeing the code lines that are causing errors

#

It’s likely one or two categories of problem that are affecting multiple lines

plain lichen
#

can I screensahre and show you?

#

should only take a min or two

viral fractal
#

It’s late for me now, in a day or two sure

plain lichen
#

Fair enough, thanks for your time man!

#

in the meantime I can try to take screenshots its just ahrd to identify the source error lines

viral fractal
#

Good luck, post the code or a screenshot and it’d be helpful to others who also hit the error

plain lichen
#

signal room_exited(old_room : Node2D, new_room : Node2D, exit_direction : int)

@export var exit_left : PackedScene = PackedScene.new()
@export var exit_right : PackedScene = PackedScene.new()
@export var exit_up : PackedScene = PackedScene.new()
@export var exit_down : PackedScene = PackedScene.new()

@export var entrance_left : Node2D
@export var entrance_right : Node2D
@export var entrance_up : Node2D
@export var entrance_down : Node2D

# Called when the node enters the scene tree for the first time.
func _ready():
    pass

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
    pass

func insert_player(player : CharacterBody2D, entered_from : int):
    var spawn_position : Vector2
    match(entered_from):
        Global.Directions.LEFT:
            spawn_position = entrance_right.position
        Global.Directions.RIGHT:
            spawn_position = entrance_left.position
        Global.Directions.UP:
            spawn_position = entrance_down.position
        Global.Directions.DOWN:
            spawn_position = entrance_up.position
    
    player.position = spawn_position

func exit_room(exit_direction : int):
    
    match(exit_direction):
        Global.Directions.LEFT:
            room_exited.emit(self, _instantiate_room_scene(exit_right), Global.Directions.LEFT)
        Global.Directions.RIGHT:
            room_exited.emit(self, _instantiate_room_scene(exit_right), Global.Directions.RIGHT)
        Global.Directions.UP:
            pass
        Global.Directions.DOWN:
            pass

func _instantiate_room_scene(room_scene : PackedScene):
    var instance : Node2D
    instance = room_scene.instantiate()
    
    return instance


func _on_exit_left_body_entered(player : PhysicsBody2D):
    exit_room(Global.Directions.LEFT)


func _on_exit_right_body_entered(player : PhysicsBody2D):
    exit_room(Global.Directions.RIGHT)
#

This is the Room.tscn tree

#

Startingroom and Secondroom are both inherited scenes from this scene and the only differences was the PackedScene selected for the exit variables in the editor

#

Let me know if that is enough detail to be helpful!