Hey, I just lost quite some time trying to debug why every time I load some asset, the properties I previously set on the loader plugin were lost.
I want to set
loadAllMaterials for the
GLTFFileLoader. I was expecting that once I set this, every subsequent load call will make use of it, especially since the plugin is registered once globally with the static
SceneLoader.registerPlugin(). So my first attempt looked something like this:
SceneLoader.GetPluginForExtension('.gltf').loadAllMaterials = true;
However that did not work, any future load call would still have
loadAllMaterials === false. I later figured out that loader plugins are recreated here (when they have a
createPlugin method) for every load call. So the solution seems to be to add a
OnPluginActivatedObservable observer, as suggested here.
However that seems quite counterintuitive to me, and I wonder what the reason for this is? It does create a bunch of single-use instances it seems, along with the required GC afterwards…