sbox-issues
sbox-issues copied to clipboard
Paths are not relative to assets folder in production
Describe the bug
I'm going through errors in my asset.party backend and I noticed that in the editor MusicPlayer.Play paths are relative to the Assets/ folder, but in production (when published to asset.party) the paths seem to be relative to the root folder...
To Reproduce
- Add a music file to your game
Assets/songs/music.mp3 - Call
MusicPlayer.Play("songs/music.mp3"); - Enter play mode in the editor
- Notice that the song plays just fine
- Publish to asset party
- Play the game through s&box (the platform)
- Notice the error in console
Expected behavior
The path should be relative to the Assets/ folder
Media/Files
No response
Additional context
This is causing errors to pop up in my game Rhythm4K (leading people to say it's broken)
This also seems to happen with UI elements.
- Add an image to
Assets/ui/logo.png - Create a new UI Panel (Screen, World, whatever you want)
- Add
<img src="/ui/logo.png" />to your UI - Enter Play Mode in the Editor
- Notice that the image displays just fine from the specified path
- Publish the game to asset.party
- Play the game through S&box (the platform)
- Notice that the image does not display at all and there is an error message in the console:
Image.Load: /ui/logo.png not found (Could not find file `/ui/logo.png`.)
Might be related:
maps now dont want to compile even tho the file setup is correct (fresh project)
I've been having this issue on a game we are working on. The project's "Resource Files" selection was not relative to /Assets/, which was wrong. This has been since fixed, make sure not to include "/Assets/" in any of your wildcards.
This might've not been your problem specifically, but worth mentioning to anyone who's been having this issue lately.