Godot Version
Godot 4.7
Issue
As context, there are two scenes that use the same script. For example, let’s say that both player.tscn and enemy.tscn use the entity.gd script. Both the player and enemy is preloaded during game initialization, and an error like this appears:
E 0:00:00:857 _printerr: res://scenes/entidades/enemigo_basico/enemigo_avispa/enemigo_avispa.tscn:83 - Parse Error: [ext_resource] referenced non-existent resource at: res://scenes/entidades/jugador/personaje/particulas_propulsor.gd.
<C++ Source> scene/resources/resource_format_text.cpp:41 @ _printerr()
The resource does exist at that path, but it seems that it can’t be used by two different scenes at the same time.
This post helped me fix the issue by using load() instead of preload() and moving the load() call from being declared and initialized at the class level to the _ready() function:
That solved the problem for me, but it didn’t answer how this bug came to be in the first place.
Both the player and enemy scenes have remained untouched for a long time, but today, when I loaded my project and ran a test, the bug suddenly appeared. In fact, this is the second time this has happened.
Because of this, it seems more like an engine loading issue than a project issue. I would like to understand the source of this bug better so I can avoid introducing similar “time bombs” into my project in the future.