# Removing observable not working

**URL:** <https://forum.babylonjs.com/t/removing-observable-not-working/18096>\
**Category:** Questions\
**Created:** [February 2, 2021, 9:36pm UTC](https://forum.babylonjs.com/t/removing-observable-not-working/18096 "2021-02-02T21:36:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![javismiles](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/javismiles/32/12924_2.png) [@javismiles](https://forum.babylonjs.com/u/javismiles)\
**Post date:** [February 2, 2021, 9:36pm UTC](https://forum.babylonjs.com/t/removing-observable-not-working/18096/1 "2021-02-02T21:36:50Z")

</div>

I have an onBeforeRenderObservable started right like in this playground  
[https://www.babylonjs-playground.com/#UP2O8#1](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

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [February 2, 2021, 10:06pm UTC](https://forum.babylonjs.com/t/removing-observable-not-working/18096/2 "2021-02-02T22:06:39Z")

</div>

well the PG works right? SO I guess something is wrong inside your code with your condition ☹

---

<div class="post-metadata">

**Author:** ![javismiles](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/javismiles/32/12924_2.png) [@javismiles](https://forum.babylonjs.com/u/javismiles)\
**Post date:** [February 2, 2021, 10:13pm UTC](https://forum.babylonjs.com/t/removing-observable-not-working/18096/3 "2021-02-02T22:13:59Z")

</div>

@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

---

<div class="post-metadata">

**Author:** ![javismiles](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/javismiles/32/12924_2.png) [@javismiles](https://forum.babylonjs.com/u/javismiles)\
**Post date:** [February 2, 2021, 10:16pm UTC](https://forum.babylonjs.com/t/removing-observable-not-working/18096/4 "2021-02-02T22:16:30Z")

</div>

found the reason, I was mixing events, onAfterRenderObservable with beforeRender! mamma mia,  
thank you, solved 🙂
