Hello, I’ve been working on a system to unload and reload assets using asset IDs and for some reason when I load, unload, then attempt to reload an asset, on the reload the PlayCanvas engine gets this error: "
playcanvas-stable.dbg.js:25932 Uncaught TypeError: asset.getPreferredFile is not a function". Anyone know what could be happening here?
For some textures I noticed if I don’t unload the material (but still unload the textures themselves) the error seemed to go away. But, now I’m trying to unload a texture that isn’t part of a material and I’m still getting the error.
I can provide more detailed debug logs if that’s helpful, but just trying to see if anyone could point me in the right direction, posting the whole asset loading system or trying to create a minimal, reproduceable example would be somewhat impractical.
Is this on one particular type of asset? Is it possible to reproduce in a new small project? We can’t really advise without seeing the logic path that you are going through.
I understand, it’s for any texture asset that gets unloaded and an attempt to load it again causes that error. If I get some time I’ll put together a test project, but I appreciate your help.
Damnit, I’m an idiot. I forgot to get the asset with the asset name and pass that asset object to “load()”. I mistakenly was just passing the asset name straight into the load function. My bad!