Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom ResourceLoader is not registerstered after Project is exported #92337

Closed
Ebbo opened this issue May 24, 2024 · 2 comments · Fixed by #93166
Closed

Custom ResourceLoader is not registerstered after Project is exported #92337

Ebbo opened this issue May 24, 2024 · 2 comments · Fixed by #93166

Comments

@Ebbo
Copy link

Ebbo commented May 24, 2024

Tested versions

Current master v4.3.beta.custom_build.b7feebefa

System information

Linux

Issue description

Project works in the editor, after exporting the project it seems that the custom resource loader is not registered.
The error message seems to change if debugging symbols is enabled while exporting.

Error with debug enabled:

SCRIPT ERROR: Invalid call. Nonexistent function 'new' in base 'GDScript'.
          at: start_dialogic_dialog (res://main.gd:13)

Without debug:

ERROR: Failed to load script "res://addons/dialogic/Resources/CharacterResourceLoader.gd" with error "Compilation failed".
   at: load (modules/gdscript/gdscript.cpp:2943)
npc_character: This is a variable test {variable}
ERROR: No loader found for resource: res://npc_character.dch (expected type: )
   at: _load (core/io/resource_loader.cpp:289)

Steps to reproduce

Start the project in the editor -> Everything works.
Export the project -> disable debugging symbols while exporting -> run the project -> Inspect error in console.

Minimal reproduction project (MRP)

new-game-project.tar.gz

@Ebbo
Copy link
Author

Ebbo commented May 25, 2024

So during reading in the documentation in the editor it says:

The registered ResourceFormatLoaders are queried sequentially to find the first one which can handle the file's extension, and then attempt loading. If loading fails, the remaining ResourceFormatLoaders are also attempted.

An optional type_hint can be used to further specify the Resource type that should be handled by the ResourceFormatLoader. Anything that inherits from Resource can be used as a type hint, for example Image.

The cache_mode property defines whether and how the cache should be used or updated when loading the resource. See CacheMode for details.

Returns an empty resource if no ResourceFormatLoader could handle the file, and prints an error if no file is found at the specified path.

GDScript has a simplified @GDScript.load() built-in method which can be used in most situations, leaving the use of ResourceLoader for more advanced scenarios.

Note: If Editor > Export > Convert Text Resources to Binary is true, @GDScript.load() will not be able to read converted files in an exported project. If you rely on run-time loading of files present within the PCK, set Editor > Export > Convert Text Resources to Binary to false.

Note: Relative paths will be prefixed with "res://" before loading, to avoid unexpected results make sure your paths are absolute.

I unchecked the option in the editor:
image

The behavior did not change and the issue is still there. So the Editor option seems not to work...

In the Export window itself I used the Text (easier debugging) mode

image

This resulted in a working export.

However is not clear to me why the Text export Mode is now needed.
This new behavior (if intended) results in a really poor user expirence.

In case Text means now there is no compilation to .gdc - this should be discussed why the load functionality changed so drastically.

@Ebbo
Copy link
Author

Ebbo commented Jun 18, 2024

I retested that behavior with v4.3.beta.custom_build.b43555168 the export works seems to be fixed by #93166

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants