Skip to content

GDScript 2.0: Cannot preload cyclic const script references #58181

@SaracenOne

Description

@SaracenOne

Godot version

b3507ab

System information

Windows 10, Vulkan, Intel® Core™ i7-8700K, Nvidia GTX 1080 (471.11)

Issue description

Scripts can preload other scripts with the 'preload' keyword, however, they will fail with the error Constant value uses script from "%s" which is loaded but not compiled if trying to preload a script which itself has preload keywords for the script which is loading, meaning it cannot resolve this cyclic dependency.

There are TODO messages in the GDScriptAnalyzer::reduce_preload which seem to hint at a strategy to support cyclic preloads, but it is unclear how this should be accomplished in the current GDScript framework. Requesting information from @vnen on the best way to potentially resolve this.

Steps to reproduce

Simply create two scripts which use the preload function to preload each other.

Minimal reproduction project

cyclic_preload.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions