[Made] Move Plugin Registration Out of SceneLoader

Hello,

SceneLoader is now obsolete in favor of ImportMeshAsync and LoadAsync. That’s great for modern async workflows, but the plugin registration system is still tied to SceneLoader:

BABYLON.SceneLoader.RegisterPlugin(new MyCustomPlugin('.ext')); BABYLON.SceneLoader.OnPluginActivatedObservable.add(plugin => { ... });

This works, but it’s somewhat confusing because SceneLoader itself is now considered obsolete, and the warnings in IDEs like Visual Studio are distracting.

It would be more consistent and clear if BabylonJS provided a global way to register plugins, for example:

BABYLON.RegisterPlugin(new MyCustomPlugin('.ext')); BABYLON.OnPluginActivatedObservable.add(plugin => { ... });

This approach would:

  • Align plugin registration with the new async import API.
  • Avoid warnings about SceneLoader being obsolete.
  • Make the API more intuitive for new projects.

Thanks for the consideration!

cc @ryantrem

It’s already been factored out to a module level function named RegisterSceneLoaderPlugin!

So you have to do it like this ?

BABYLON.RegisterSceneLoaderPlugin(plugin);
 
plugin.OnPluginActivatedObservable.add();

Yes for the first line, no for the second line. OnPluginActivatedObservable was a legacy mechanism to get the instance of the plugin so you could configure it before it actually loaded the model. In the new APIs, you can just pass options in directly with the top level load call to configure plugins. You can find more details here: Babylon.js docs

Ok, I understand. Thanks for the clarification.

2 Likes