I have a method that I need to do unit test, which include
scene.onAfterRenderObservable.add(() => {…}});
when I do unit test, I find scene.onAfterRenderObservable.add does not get called, I added scene.render(), but looks like it still does not get called, any idea?
Update:
This is the way I create engine and scene in my unit test
let engine = new NullEngine();
let scene = new Scene(engine);
It’s difficult to say without a repro, but what scene.onAfterRenderObservable.add(function); does is register a function to be called once the scene is done rendering (by adding it to the onAfterRenderObservable list). So on the render loop, you should expect function to be called, not the add method.