Hi, I’m debugging my code and I think the load function of my costum AssetLoader is not being called. My question is now, is the load function of the AssetLoader called somewhere behind the screens ? Because I can’t find where it is called. I tried searching the documentation but didn’t find any information about the AssetLoader class only this : http://hub.jmonkeyengine.org/javadoc/com/jme3/asset/AssetLoader.html
It’s called when the asset is loaded if the loader is registered properly. We can’t see that code so it’s hard to say.
The loader is registered properly, I am able to load everything properly. But in one instance it does not call the load function. I have no idea why. So I wanted to find out what triggers this load method. I thought maybe something with the assetmanager … but can’t find it atm.
In desktop environments, AssetLoader.load() is typically invoked by DesktopAssetManager.loadAsset()
For instance, during initialization of a SimpleApplication, the GUI font is loaded this way. Perhaps that invocation happens before your loader is registered.
Ok I found the error. In this loadAsset function there is a line that fetches the asset from the cache if that is possible.
[java]Object obj = cache != null ? cache.getFromCache(key) : null;[/java]
Though I’m loading the same asset twice (which is necessairy for my goal), and this function fetches the asset from the cache, while I need it to load it again. Is there any way to circumvent this cache check so that the asset is loaded again ?
Fixed it by clearing the cache of the assetmanager !
I’m glad you solved the problem.
I think if you use assetkeys you can set the caching mode there more clean
@Ojtwist said: The loader is registered properly, I am able to load everything properly. But in one instance it does not call the load function. I have no idea why. So I wanted to find out what triggers this load method. I thought maybe something with the assetmanager ... but can't find it atm.
I’m glad you got your problem solved but note: in the future if you include this important type of information in the first post then you can get a proper response right away.