Sys.load_resource does not work in Version 1.2.97 for windows (DEF-2513) (SOLVED)

After editor update (for Windows 7) our project started to launch with error ):
It’s can be reproduced, if:

  1. Create new project
  2. Add json-file
  3. Add a line about resources to .project file
  4. Add simple script with sys.load_resource calling
    Console:
    WARNING:SCRIPT: Failed to load resource: /main/doc.json (-3)
1 Like

Here is an example
example.zip (1.3 KB)

Hmm, I wonder if this is caused by the new LiveUpdate functionality. @jakob.pogulis and @Johan_Beck-Noren?

Great with a small example that reproduces the bug :slight_smile:

One thing I noticed is the path in game.project is /main/localization.json and the call to load_resource tried to load a file at path /main/resources/localization.json. Unfortunately changing the path still produces the same result.

I am able to load the custom resource if the prefix ‘/’ is removed from the path in game.project. E.g. replace

custom_resources = /main/localization.json

with

custom_resources = main/localization.json

and the resource seems to load fine. Be sure to do a rebuild & launch after modifying game.project. Hopefully this will resolve your issue as well.

The latest release contained two big new features LiveUpdate and Native Extensions. Both features have touched the resource system so this might be a regression that was missed.

7 Likes

Thank you, it’s working now!

3 Likes

I have investigated it a bit further this morning, and it seems that we previously supported both /a/b.json and a/b.json as paths for custom_resources. With the release of 1.2.97 it looks like we accidentally broke the “absolute” version of specifying custom resources in the game.project file. I have created a ticket for this and I’m working on a fix for it: DEF-2513

Sorry about this, and thanks for reporting! :sweat_smile: (In the meantime, as a workaround, you can still specify custom resources without a leading slash.)

4 Likes

Solved in Defold 1.2.99

2 Likes