Skip to content

Regression due to GDScript cache changes for preload in Godot 4.3 dev 4+ #90362

@mhilbrunner

Description

@mhilbrunner

Tested versions

System information

Windows 11

Issue description

It looks like the change in #85501, included in Godot 4.3 dev 4 may have some side effects.
With this change included, starting W4 Game's Planet Crashers demo fails with a compilation error in weapon_drop.gd:

SCRIPT ERROR: Parse Error: Could not preload resource file "res://items/weapon_drop.tscn".
          at: GDScript::reload (res://characters/character.gd:420)
SCRIPT ERROR: Compile Error:
          at: GDScript::reload (res://items/weapon_drop.gd:-1)
ERROR: Failed to load script "res://items/weapon_drop.gd" with error "Parse error".
   at: load (modules\gdscript\gdscript.cpp:2769)

Note that the source line for the error is -1, and that this script is attached to a scene that gets preload()ed here.
Changing that preload() to load() fixes the error. Even when moved to the top of the file, the scene can't be preload()ed: const drop_scene := preload("res://items/weapon_drop.tscn") at the top fails with the same error.

gdscript.cpp:2769 seems to point to the script attached to the preload()ed scene not being found in the GDScript cache. Reverting the above PR locally seems to fix this. Also see #85081.

Steps to reproduce

Load the above mentioned project with the linked change included. The error is output to console.
Starting the project from the editor results in the same error.
Note that later commits of the Planet Crasher's demo work around this error, so use 3f07e50ed09 to test.

Minimal reproduction project (MRP)

MRP by Jordyfel

Not really minimal:
Planet Crashers repository
Direct link to ZIP file

Note that this is a multiplayer project and may open network connections to W4 Games servers.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Release Blocker

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions