I have an onBeforeRenderObservable started right like in this playground
https://www.babylonjs-playground.com/#UP2O8#1
and after a condition is met I stop it with
scene.onBeforeRenderObservable.remove(derObs);
however it just never stops, no matter what I try,
what could be the reasons for it not stopping?
thank you ,sorry cannot make a playground of the exact scenario as its all embedded on a very large codebase, just looking for some tips of why it may not stop
1 Like
well the PG works right? SO I guess something is wrong inside your code with your condition 
1 Like
@Deltakosh I agree, but I am so puzzled,there is no condition anymore etc, I just put a button, and I do this:
if (props.desState === false){
derObs=sceneHolder.onAfterRenderObservable.add(() => {
console.log(“check”);
});
}
else {
var removed= sceneHolder.onBeforeRenderObservable.remove(derObs);
console.log("removed?: "+removed);
}
if you click button start it, if you click it again, stop it
and the removal command returns false, it just fails, so puzzled
found the reason, I was mixing events, onAfterRenderObservable with beforeRender! mamma mia,
thank you, solved 
2 Likes