sbox-issues icon indicating copy to clipboard operation
sbox-issues copied to clipboard

Paths are not relative to assets folder in production

Open CarsonKompon opened this issue 1 year ago • 2 comments
trafficstars

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

  1. Add a music file to your game Assets/songs/music.mp3
  2. Call MusicPlayer.Play("songs/music.mp3");
  3. Enter play mode in the editor
  4. Notice that the song plays just fine
  5. Publish to asset party
  6. Play the game through s&box (the platform)
  7. 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)

image

CarsonKompon avatar May 06 '24 19:05 CarsonKompon

This also seems to happen with UI elements.

  1. Add an image to Assets/ui/logo.png
  2. Create a new UI Panel (Screen, World, whatever you want)
  3. Add <img src="/ui/logo.png" /> to your UI
  4. Enter Play Mode in the Editor
  5. Notice that the image displays just fine from the specified path
  6. Publish the game to asset.party
  7. Play the game through S&box (the platform)
  8. 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`.)

CarsonKompon avatar May 06 '24 20:05 CarsonKompon

Might be related:

explorer_SBRjC4sYlz

maps now dont want to compile even tho the file setup is correct (fresh project)

Andiq avatar May 11 '24 14:05 Andiq

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.

image

DevulTj avatar May 30 '24 13:05 DevulTj