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

Godot 4 exports to all platforms unable to load any custom resources #77886

Closed
vickylance opened this issue Jun 5, 2023 · 12 comments
Closed

Comments

@vickylance
Copy link

vickylance commented Jun 5, 2023

Godot version

4.0.3-stable

System information

Macos-Universal - Standard build

Issue description

  • I have exported my project for macos & Web
  • When running the exported project getting the error - USER ERROR: No loader found for resource: <resource path>
  • But its working in editor when played from editor
  • I am also running Godot on compatibility mode

Local Nodejs static server with custom headers:
Screenshot 2023-06-05 at 9 50 05 PM

Itch.io upload with SharedArrayBuffer flag
Screenshot 2023-06-05 at 9 33 16 PM

Steps to reproduce

Create a custom resource and then export to web and try serving the project locally or on itch.io, godot runtime is not able to load the custom resources.

Minimal reproduction project

Project Link - https://github.com/vickylance/CustomResourceExportBug

@Calinou
Copy link
Member

Calinou commented Jun 5, 2023

Can you reproduce this when exporting the project to a native (non-web) platform?

@vickylance
Copy link
Author

@Calinou Ok so I just tested it for macos export and I see the same issue in that as well. But its working when played in editor.

@vickylance
Copy link
Author

Is it a known bug? I am u able to find any other similar bugs in the issues

@Calinou
Copy link
Member

Calinou commented Jun 5, 2023

Is it a known bug? I am u able to find any other similar bugs in the issues

This may or may not be a bug, but the project is too large to be considered minimal. Can you create a minimal reproduction project with just one scene and one custom resource?

@vickylance
Copy link
Author

@Calinou Created a minimal reproducable bug repo - https://github.com/vickylance/CustomResourceExportBug
Having custom resource and exporting is crashing on the exported build

@Calinou
Copy link
Member

Calinou commented Jun 5, 2023

@Calinou Calinou added the bug label Jun 5, 2023
@vickylance
Copy link
Author

Reproducible in Godot 4.1.dev4 as well

@vickylance
Copy link
Author

vickylance commented Jun 6, 2023

@Calinou This is basically not working with any Custom Resource type itself.Created an even simpler project without any custom classes and only a single String in the Resource and it still failing on exported builds.

image

Bare minimum reproducible project - Test.zip

@vickylance vickylance changed the title Godot 4 Web Export unable to load custom resources Godot 4 Export unable to load any custom resources Jun 6, 2023
@vickylance vickylance changed the title Godot 4 Export unable to load any custom resources Godot 4 exports to all platforms unable to load any custom resources Jun 6, 2023
@BrastenXBL
Copy link

This is not a bug. You are attempting to use DirAccess to access the Exported file structure and automatedly collect all the Access Paths for your resources. This is not a great way to create an automated "res://" Array or Dictionary of the Resources in your project. The fast fix is to catch for the ".remap" file extension, and remove it.

This is a very dirty fast way to do this:

while file_name != "":
	print_debug(file_name) # human visual on file name found, remove for production
	if file_name.ends_with(".remap"):
		file_name = file_name.replace(".remap", "")
	if not dir.current_is_dir():

@cassidydotdk
Copy link

This is not a great way to create an automated "res://" Array or Dictionary of the Resources in your project

Fwiw your fast and dirty way does the trick. For custom text resources, flipping this setting works as well. https://docs.godotengine.org/en/stable/classes/class_projectsettings.html#class-projectsettings-property-editor-export-convert-text-resources-to-binary

This won't work if you're scanning for binary files however. E.g. images will need a "replace-job" on ",import".

Clearly this isn't the way; but is there a way at all to approach this? ResourceLoader doesn't have any scan capabilities.

@matheusmdx
Copy link
Contributor

I think this issue can be closed because now we have ResourceLoader.list_directory after pr #96590

@Calinou
Copy link
Member

Calinou commented Jan 10, 2025

This was implemented by #96590, closing.

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

No branches or pull requests

5 participants