If SpriteRenderer is disposed before its render
function is called at least once, there’s a runtime error.
Easiest way to reproduce: create an instance of SpriteManager and then dispose it immediately
(PG).
Another way to reproduce would be to create a Scene with the spritesEnabled: false
option and then try to dispose SpriteManager.
I suppose those two lines:
should be:
this._drawWrapperBase?.dispose();
this._drawWrapperDepth?.dispose();
And also perhaps types should state that those properties can be undefined, since they are now being initialized asynchronously:
private _drawWrapperBase?: DrawWrapper;
private _drawWrapperDepth?: DrawWrapper;
Thank you!