theRAPTLab / gsgo

GEM-STEP Foundation repo migrated from GitLab June 2023
1 stars 1 forks source link

Could not load sprite with assetId "worm.png" #437

Open benloh opened 2 years ago

benloh commented 2 years ago

If you see console errors like this:

getSpriteDimensions: Could not load sprite with assetId "worm.png"
TypeError: Cannot read properties of undefined (reading 'rsrc')
getSpriteDimensions @ as-load-sprites.ts:163

and

class-visual.ts:191 class-visual failed setting texture name worm.png for agent CC20_0 rsrc undefined

The issue is usually caused by having a spritesheet with the same name. e.g. in the sprites directory there are both:

worm.json
worm.png

Not sure if this is an asset loader / asset manager issue or something else.

The workaround is to remove the *.json file if it's not being used, or to make sure you don't have two files with the same name.

benloh commented 2 years ago

In GitLab by @daveseah on Sep 7, 2022, 07:16

This might be relevant: the sprite loader uses the manifest file that's autogenerated by the AssetServer code. The autogenerator scans the directory for files with particular extensions; for sprites this is .json and .png.

There is a rudimentary filter to avoid sending duplicates entries. The filter code is pretty crude, based on my examination of a handful of .json files as I didn't have an official reference for their JSON format, and I think there is actually a check to not send a .png file that also has a .json file.

This is all on the server side in the ursys codebase.