Some assets are placed in a subdirectory of the assets folder,
You use forward slashes when specifying the path of the asset to load,
then the aforementioned assets won't load.
How to Replicate
Be on Windows
Place an asset in a subdirectory of the assets dir (e.g., assets/foo/bar.png)
Load the asset (asset_server.load("foo/bar.png"))
Observe a loading error (path not found)
Expected Result
Assets being actually loaded.
Notes
Apparently Paths do not convert forward slashes into backward ones in Wasm builds, which is the cause of the problem.
I think using backslashes won't fix the problem: it will break on Linux/MacOS instead (I haven't tested it, but I assume backslashes won't be converted into forward slashes on these platforms).
This is inconvenient since it hinders cross-platform development.
What web server are you using to serve the wasm file? Does it also serve the asset directory? What is the request you see in the browser console?
Nevermind I missed in which repo we were 🤦
Issue
If some conditions are met:
then the aforementioned assets won't load.
How to Replicate
assets/foo/bar.png
)asset_server.load("foo/bar.png")
)Expected Result
Assets being actually loaded.
Notes
Apparently
Path
s do not convert forward slashes into backward ones in Wasm builds, which is the cause of the problem.I think using backslashes won't fix the problem: it will break on Linux/MacOS instead (I haven't tested it, but I assume backslashes won't be converted into forward slashes on these platforms).
This is inconvenient since it hinders cross-platform development.