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

[4.3] ResourceLoader.load not working for dedicated_server #97467

Closed
jasonfma opened this issue Sep 25, 2024 · 1 comment · Fixed by #97769
Closed

[4.3] ResourceLoader.load not working for dedicated_server #97467

jasonfma opened this issue Sep 25, 2024 · 1 comment · Fixed by #97769

Comments

@jasonfma
Copy link

Tested versions

  • Reproducible in v4.3.stable.official [77dcf97]
  • Not reproducible in 4.2

System information

dedicated server built using MacOS M3 Pro - deployed ARM64

Issue description

I'm trying to load a script on start but it doesn't seem to be available when the app is built as a dedicated server.

Here is the offending line:

var version_file = ResourceLoader.load("res://scripts/version.gd", "", ResourceLoader.CACHE_MODE_IGNORE)

Error:

2024-09-25T19:12:07.983Z
	
ERROR: Attempt to open script 'res://scripts/version.gd' resulted in error 'File not found'.
	
2024-09-25T19:12:07.983Z
	
at: load_source_code (modules/gdscript/gdscript.cpp:1094)
	
2024-09-25T19:12:07.983Z
	
ERROR: Failed to load script "res://scripts/version.gd" with error "File not found".
	
2024-09-25T19:12:07.983Z
	
at: load (modules/gdscript/gdscript.cpp:2936)

When I change to using load, the error goes away. This isn't a viable workaround for me as I'm loading this file in a pck and need the updated version after loading the pck (i.e. no cache).

load("res://scripts/version.gd")

Steps to reproduce

  1. Load a script file using ResourceLoader.load(<script_file>, "", ResourceLoader.CACHE_MODE_IGNORE)
  2. build app as dedicated_server (arm64)
  3. run and see error

Minimal reproduction project (MRP)

resourceloaderissue.zip

@matheusmdx
Copy link
Contributor

Bisecting points to #89005 as the culprit, @dalexeev

image


Note the error doesn't stop the script from load correctly:

With a valid script path:

ERROR: Attempt to open script 'res://test.gd' resulted in error 'File not found'.
   at: (modules\gdscript\gdscript.cpp:1033)
ERROR: Failed to load script "res://test.gd" with error "File not found".
   at: ResourceFormatLoaderGDScript::load (modules\gdscript\gdscript.cpp:2825)
<GDScript#-9223372013349894945> # Print from the result of ResourceLoader.load()


With a invalid script path:

ERROR: Attempt to open script 'res://tes.gd' resulted in error 'File not found'.
   at: (modules\gdscript\gdscript.cpp:1033)
ERROR: Failed loading resource: res://tes.gd. Make sure resources have been imported by opening the project in the editor at least once.
   at: (core\io\resource_loader.cpp:278)
ERROR: Error loading resource: 'res://tes.gd'.
   at: (core\core_bind.cpp:73)
<Object#null> # Print from the result of ResourceLoader.load()

@github-project-automation github-project-automation bot moved this to For team assessment in GDScript Issue Triage Sep 30, 2024
@dalexeev dalexeev self-assigned this Sep 30, 2024
@dalexeev dalexeev moved this from For team assessment to Fix pending review in GDScript Issue Triage Oct 3, 2024
@dalexeev dalexeev added this to the 4.4 milestone Oct 3, 2024
@github-project-automation github-project-automation bot moved this from Fix pending review to Done in GDScript Issue Triage Oct 4, 2024
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.

4 participants