Material.OnEventObservable clear cause material plugins not work

OnEventObserver added in function RegisterMaterialPlugin is cleared in these lines so when I open an engine after disposing another engine, material plugins are not able to register.

That’s expected, as there are no more active engines, some cleanups are performed.

A workaround is to create the new engine before releasing the existing one. That way, this code won’t trigger in the dispose method:

As far as I am concerned, inited here should be set to false again when all engines disposed? So I can register material plugins again when opening the second engine. It is really strange for me that I have to keep an engine all the time to keep the plugins.

I think this one is a bug, here’s the fix: